Last active
December 30, 2015 15:59
-
-
Save vitormil/7852111 to your computer and use it in GitHub Desktop.
/etc/nginx/cond.d/myappname.conf
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
upstream myappname { | |
server unix:/var/run/myappname/web.sock fail_timeout=0; | |
} | |
server { | |
server_name .oldappname.com; | |
rewrite ^ http://myappname.com$request_uri? permanent; | |
} | |
server { | |
listen 80; | |
server_name www.appname.com; | |
rewrite ^ http://appname.com$request_uri permanent; | |
} | |
server { | |
listen 443 ssl; | |
server_name appname.com www.appname.com; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/myappname.com/server.crt; | |
ssl_certificate_key /etc/nginx/ssl/myappname.com/server.key; | |
ssl_session_cache shared:SSL:50m; | |
ssl_session_timeout 10m; | |
ssl_prefer_server_ciphers on; | |
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK'; | |
return 301 http://myappname.com$request_uri; | |
} | |
server { | |
listen 80; | |
client_max_body_size 2M; | |
server_name myappname.com assets0.myappname.com assets1.myappname.com assets2.myappname.com assets3.myappname.com; | |
keepalive_timeout 5; | |
root /var/www/myappname/current/public; | |
access_log off; | |
error_log off; | |
location ~ \.php$ { | |
deny all; | |
} | |
location ~ ^/(assets)/ { | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
location / { | |
try_files $uri/index.html $uri.html $uri @app; | |
error_page 404 /404.html; | |
error_page 422 /422.html; | |
error_page 500 502 503 504 /500.html; | |
error_page 403 /403.html; | |
} | |
location @app { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-FORWARDED_PROTO $scheme; | |
proxy_redirect off; | |
proxy_pass http://myappname; | |
} | |
location = /favicon.ico { | |
expires max; | |
add_header Cache-Control public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment