Skip to content

Instantly share code, notes, and snippets.

@joaohcrangel
Created November 8, 2021 17:45
Show Gist options
  • Save joaohcrangel/e4a6ed129d2d736d511627cab465ed1e to your computer and use it in GitHub Desktop.
Save joaohcrangel/e4a6ed129d2d736d511627cab465ed1e to your computer and use it in GitHub Desktop.
server {
server_name subdomain.domain.com.br;
error_page 500 502 503 504 /custom_50x.html;
location = /custom_50x.html {
root /usr/share/nginx/html;
internal;
}
index index.html index.htm index.nginx-debian.html;
location ^~ /assets/ {
gzip_static on;
expires 12h;
add_header Cache-Control public;
}
location / {
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:4000;
}
listen [::]:443 ssl;
listen 443 ssl;
}
server {
if ($host = subdomain.domain.com.br) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
server_name subdomain.domain.com.br;
return 404;
}
@joaohcrangel
Copy link
Author

ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment