Created
November 17, 2024 15:00
-
-
Save andrei-markeev/3c03efba9791f0e9630396bc6df4be58 to your computer and use it in GitHub Desktop.
Force https with NGINX
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
server { | |
listen 80; | |
server_name mydomain.com; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
server_name mydomain.com; | |
add_header Strict-Transport-Security "max-age=31536000" always; | |
ssl_certificate /path/to/mydomain.com.crt; | |
ssl_certificate_key /path/to/mydomain.com.key; | |
# ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment