Skip to content

Instantly share code, notes, and snippets.

@TimFletcher
Created December 1, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TimFletcher/bb92b455ce9fd9a7f993 to your computer and use it in GitHub Desktop.
Save TimFletcher/bb92b455ce9fd9a7f993 to your computer and use it in GitHub Desktop.
Nginx SSL Redirect
# --- 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...
}
@wzalazar
Copy link

thanks, the redirect it's working...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment