Created
January 22, 2025 23:45
-
-
Save linzj/412760c5d15853e2d8db5f5b8786d876 to your computer and use it in GitHub Desktop.
create a https serve
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Generate SSL certificates if they don't exist | |
| if [ ! -f key.pem ] || [ ! -f cert.pem ]; then | |
| openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=localhost" >/dev/null 2>&1 | |
| fi | |
| # Start HTTPS server | |
| http-server -S -C cert.pem -K key.pem -p 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment