Skip to content

Instantly share code, notes, and snippets.

@willc0de4food
Last active July 12, 2017 15:13
Show Gist options
  • Save willc0de4food/173605bb0bb9cc3b8b6349cbfa6b9ce0 to your computer and use it in GitHub Desktop.
Save willc0de4food/173605bb0bb9cc3b8b6349cbfa6b9ce0 to your computer and use it in GitHub Desktop.
nginx + passenger + rails virtual host http + https example
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";
}
}
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