Skip to content

Instantly share code, notes, and snippets.

@charusat09
Created August 21, 2017 11:46
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 charusat09/e3043e7bffb0ef285303ba90cbc4b252 to your computer and use it in GitHub Desktop.
Save charusat09/e3043e7bffb0ef285303ba90cbc4b252 to your computer and use it in GitHub Desktop.
This is example for /etc/nginx/sites-available/default file
upstream puma {
server unix:///var/www/apps/PROJECT/shared/sockets/puma.sock;
}
server {
listen 80;
server_name 'example.com';
# Discourage deep links by using a permanent redirect to home page of HTTPS site
#return 301 https://$host;
# Alternatively, redirect all HTTP links to the matching HTTPS page
return 301 https://$server_name$request_uri;
}
server {
server_name 'exampple.com';
listen 443 ssl;
root /var/www/apps/PROJECT/shared/public;
ssl_certificate /etc/nginx/ssl/exampple.chained.crt;
ssl_certificate_key /etc/nginx/ssl/exampple.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; always";
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/ssl/exampple.com.chained.crt;
access_log /var/www/apps/PROJECT/shared/log/puma.stdout.log;
error_log /var/www/apps/PROJECT/shared/log/puma.stderr.log info;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @puma;
location @puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://puma;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment