Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save batFormat/1d38fd82094014d691ff3a45393d44ea to your computer and use it in GitHub Desktop.
Save batFormat/1d38fd82094014d691ff3a45393d44ea to your computer and use it in GitHub Desktop.
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