Created
November 7, 2017 08:42
-
-
Save belinskidima/fc7cd1f4b136edcab8e2a8717825101f to your computer and use it in GitHub Desktop.
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
user www-data; | |
worker_processes 1; | |
pid /run/nginx.pid; | |
events { | |
worker_connections 768; | |
} | |
http { | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 65; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
gzip on; | |
gzip_disable "msie6"; | |
upstream unicorn { | |
server unix:/tmp/unicorn.app.sock fail_timeout=0s; | |
} | |
server { | |
listen 80; | |
server_name api.domain.com; | |
return 301 https://www.domain.com; | |
} | |
server { | |
listen 443 default; | |
server_name api.doamin.com; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/server.pem; | |
ssl_certificate_key /etc/nginx/ssl/server.key; | |
root /home/deploy/app/current/public; | |
try_files $uri/index.html $uri @unicorn; | |
client_max_body_size 20M; | |
location ^~ /assets/ { | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
location @unicorn { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Proto https; # New header for SSL | |
proxy_redirect off; | |
proxy_pass http://unicorn; | |
} | |
error_page 500 502 503 504 /500.html; | |
keepalive_timeout 10; | |
} | |
include /etc/nginx/conf.d/*.conf; | |
include /etc/nginx/sites-enabled/*; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment