Created
June 23, 2017 21:44
-
-
Save asapzacy/254db9eb2adbadd331333e62d5fd7a47 to your computer and use it in GitHub Desktop.
uxscoreboard nginx config
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
# www - redirect all www requests to non-www: | |
server { | |
server_name www.uxscoreboard.com; | |
listen 80; | |
listen 443; | |
listen [::]:80; | |
listen [::]:443 ssl; | |
ssl_certificate /etc/letsencrypt/live/uxscoreboard.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/uxscoreboard.com/privkey.pem; | |
ssl_trusted_certificate /etc/letsencrypt/live/uxscoreboard.com/chain.pem; | |
include snippets/ssl-params.conf; | |
return 301 http://uxscoreboard.com$request_uri; | |
} | |
# HTTP - redirect all HTTP requests to HTTPS: | |
server { | |
server_name uxscoreboard.com; | |
listen 80; | |
listen [::]:80; | |
return 301 https://uxscoreboard.com$request_uri; | |
} | |
# HTTPS - proxy requests on to local nodejs app: | |
server { | |
server_name uxscoreboard.com; | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
root /var/www/uxscoreboard/html; | |
ssl_certificate /etc/letsencrypt/live/uxscoreboard.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/uxscoreboard.com/privkey.pem; | |
ssl_trusted_certificate /etc/letsencrypt/live/uxscoreboard.com/chain.pem; | |
include snippets/ssl-params.conf; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://localhost:9090; | |
proxy_ssl_session_reuse off; | |
proxy_set_header Host $http_host; | |
proxy_cache_bypass $http_upgrade; | |
proxy_redirect off; | |
root /home/zac/apps/uxscoreboard/dist; | |
try_files $uri $uri/ /index.html; | |
} | |
location /api/ { | |
proxy_pass http://localhost:9090/api/; | |
} | |
location ~ ^/assets.+\.(?:css|png|jpg|svg|gif|ico)$ { | |
root /home/zac/apps/uxscoreboard/dist; | |
expires 7d; | |
add_header Pragma public; | |
add_header Cache-Control "public"; | |
try_files $uri $uri/ /index.html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment