Last active
July 12, 2017 15:13
-
-
Save willc0de4food/173605bb0bb9cc3b8b6349cbfa6b9ce0 to your computer and use it in GitHub Desktop.
nginx + passenger + rails virtual host http + https example
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
server { | |
listen 80; | |
listen [::]:80; | |
server_name your_domain.com www.your_domain.com; | |
root /var/www/html/app_name/public; | |
passenger_enabled on; | |
passenger_app_env production; | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires 744h; | |
log_not_found off; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
} |
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
server { | |
listen 443 ssl; | |
listen [::]:443 ssl; | |
server_name your_domain.com www.your_domain.com; | |
root /var/www/html/app_name/public; | |
passenger_enabled on; | |
passenger_app_env production; | |
ssl_certificate /etc/letsencrypt/live/your_domain.com/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/your_domain.com/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires 744h; | |
log_not_found off; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment