Created
December 1, 2015 14:03
-
-
Save TimFletcher/bb92b455ce9fd9a7f993 to your computer and use it in GitHub Desktop.
Nginx SSL Redirect
This file contains 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
# --- Redirect http://respiratoryexam.com and http://www.respiratoryexam.com to https --- | |
server { | |
listen 80; | |
server_name respiratoryexam.com | |
www.respiratoryexam.com; | |
return 301 https://respiratoryexam.com$request_uri; | |
} | |
# --- Redirect https://www.respiratoryexam.com to http://respiratoryexam.com --- | |
server { | |
listen 443 ssl; | |
server_name www.respiratoryexam.com; | |
ssl_certificate /home/deploy/www/respiratoryexam.com/certs/respiratoryexam_com.crt; | |
ssl_certificate_key /home/deploy/www/respiratoryexam.com/certs/respiratoryexam_com.key; | |
return 301 https://respiratoryexam.com$request_uri; | |
} | |
# --- https://www.respiratoryexam.com --- | |
server { | |
listen 443 ssl default deferred; | |
server_name respiratoryexam.com; | |
...rest of your SSL config goes here... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks, the redirect it's working...