Forked from ArtemChugainov/gist:ce1ec48d22f96817d4ccfd749a0ce1f9
Last active
July 29, 2019 19:15
-
-
Save batFormat/1d38fd82094014d691ff3a45393d44ea to your computer and use it in GitHub Desktop.
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 { | |
listen 80; | |
#listen 443 ssl http2; | |
# set path to your project dir | |
set $root_path /root/app/Chugainov; | |
# your domain | |
server_name chugainov.ru; | |
# static content directory | |
root $root_path/public; | |
# proxy to nuxt renderer. | |
location / { | |
proxy_pass http://localhost:3000; | |
} | |
# serve nuxt bundle with max cache life. Only compatible with nuxt 2.*. For 1.*, remove last 'client' from alias | |
location ~^\/_nuxt(.*)$ { | |
alias $root_path/.nuxt/dist/client/$1; | |
gzip on; | |
gzip_comp_level 6; | |
gzip_vary on; | |
gzip_types text/css application/json application/javascript text/javascript application/x-font-ttf font/opentype; | |
expires max; | |
} | |
# serve static content | |
location ~* \.(js|jpg|jpeg|txt|png|css|pdf|ico|map)$ { | |
gzip_static on; | |
expires 30d; | |
} | |
# refirect from /path/ to /path | |
rewrite ^/(.*)/$ /$1 permanent; | |
} | |
# redirect for domain aliases | |
server { | |
server_name www.chugainov.ru; | |
return 301 https://$host$request_uri; | |
} | |
# placeholder if user requests your servers' IP. | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/www/html; | |
server_name _; | |
location / { | |
try_files $uri =404; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment