Skip to content

Instantly share code, notes, and snippets.

@linzj
Created January 22, 2025 23:45
Show Gist options
  • Select an option

  • Save linzj/412760c5d15853e2d8db5f5b8786d876 to your computer and use it in GitHub Desktop.

Select an option

Save linzj/412760c5d15853e2d8db5f5b8786d876 to your computer and use it in GitHub Desktop.
create a https serve
#!/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