Created
June 27, 2016 01:14
-
-
Save gkrizek/abc39264fc776b89ea96a4dcabf3e706 to your computer and use it in GitHub Desktop.
NGINX configuration for a Meteor application. See: https://blog.gitrandom.com
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_tokens off; | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { | |
listen 80 default_server; | |
server_name example.com; | |
return 301 https://example.com$request_uri; | |
} | |
server { | |
listen 443 ssl spdy; | |
server_name example.com; | |
root /var/www/example; | |
include cloudflare; | |
ssl_certificate /etc/pki/tls/certs/example.crt; | |
ssl_certificate_key /etc/pki/tls/private/example.key; | |
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; | |
ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!3DES:!DES:!MD5:!PSK:!RC4:!RSA'; | |
ssl_protocols TLSv1.1 TLSv1.2; | |
ssl_prefer_server_ciphers on; | |
ssl_session_cache shared:SSL:10m; | |
location / { | |
gzip on; | |
gzip_http_version 1.1; | |
gzip_min_length 256; | |
gzip_comp_level 5; | |
gzip_proxied any; | |
gzip_vary on; | |
gzip_types | |
application/atom+xml | |
application/javascript | |
application/json | |
application/rss+xml | |
application/vnd.ms-fontobject | |
application/x-font-ttf | |
application/x-web-app-manifest+json | |
application/xhtml+xml | |
application/xml | |
font/opentype | |
image/png | |
image/svg+xml | |
image/x-icon | |
text/css | |
text/plain | |
text/x-component; | |
proxy_pass http://localhost:3000; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
if ($uri != '/') { | |
expires 30d; | |
} | |
} | |
#custom error pages if Meteor stopped working or hit a restricted URL | |
error_page 401 /401.html; | |
location = /401.html { | |
root /var/www/error; | |
} | |
error_page 404 /404.html; | |
location = /404.html { | |
root /var/www/error; | |
} | |
error_page 502 /502.html; | |
location = /502.html { | |
root /var/www/error; | |
} | |
location = /error-logo.svg { | |
root /var/www/error; | |
} | |
access_log /var/log/nginx/example-access.log; | |
error_log /var/log/nginx/example-error.log; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment