fix: estabiliza HMR no Nginx e garante sincronia de variáveis
This commit is contained in:
parent
2214f04a8a
commit
0230a26302
1 changed files with 22 additions and 3 deletions
25
nginx.conf
25
nginx.conf
|
|
@ -1,7 +1,17 @@
|
||||||
server {
|
server {
|
||||||
listen 80;
|
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;
|
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 / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:3000;
|
proxy_pass http://127.0.0.1:3000;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
|
|
@ -12,27 +22,36 @@ server {
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
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)
|
# HMR (Hot Module Replacement) - Crucial para Next.js Dev
|
||||||
location /_next/webpack-hmr {
|
location /_next/webpack-hmr {
|
||||||
proxy_pass http://127.0.0.1:3000/_next/webpack-hmr;
|
proxy_pass http://127.0.0.1:3000/_next/webpack-hmr;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
proxy_read_timeout 86400; # Manter conexão aberta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 443 ssl;
|
||||||
server_name api-ghj.rede5.com.br;
|
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 / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:8521;
|
proxy_pass http://127.0.0.1:8521;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection 'upgrade';
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_cache_bypass $http_upgrade;
|
proxy_cache_bypass $http_upgrade;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue