Created
November 8, 2021 17:45
-
-
Save joaohcrangel/e4a6ed129d2d736d511627cab465ed1e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/