gohorsejobs/nginx.conf

61 lines
2 KiB
Nginx Configuration File

server {
listen 80;
server_name ghj.rede5.com.br api-ghj.rede5.com.br;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name ghj.rede5.com.br;
ssl_certificate /etc/letsencrypt/live/ghj.rede5.com.br/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ghj.rede5.com.br/privkey.pem;
# Configurações de Proxy para o Frontend
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
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;
# Aumentar timeouts para desenvolvimento
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# HMR (Hot Module Replacement) - Crucial para Next.js Dev
location /_next/webpack-hmr {
proxy_pass http://127.0.0.1:3000/_next/webpack-hmr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 86400; # Manter conexão aberta
}
}
server {
listen 443 ssl;
server_name api-ghj.rede5.com.br;
ssl_certificate /etc/letsencrypt/live/ghj.rede5.com.br/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ghj.rede5.com.br/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8521;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
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;
}
}