Created
October 7, 2011 17:34
-
-
Save guilherme/1270879 to your computer and use it in GitHub Desktop.
nginx with ssl and rewrite rule
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 www.myapp.com myapp.com; | |
rewrite ^.* https://myapp.com$request_uri permanent; | |
} | |
server { | |
listen 443; | |
ssl on; | |
ssl_certificate /etc/ssl/certs/sslchain.crt; | |
ssl_certificate_key /etc/ssl/certs/server.key; | |
rails_env production; | |
server_name myapp.com www.myapp.com; | |
root /var/www/myapp.com/current/public; | |
passenger_enabled on; | |
passenger_friendly_error_pages off; | |
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains"; | |
if ($host = 'www.myapp.com' ) { | |
rewrite ^/(.*)$ https://myapp.com/$1 permanent; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment