Files
loyaly_cutomerweb/nginx.conf
2026-09-28 19:44:05 +05:30

74 lines
2.9 KiB
Nginx Configuration File

# ─────────────────────────────────────────────────────────────────────────────
# NOT USED BY THE DEPLOYED IMAGE. Kept only as a reference.
#
# The image ran `node server.js & nginx -g 'daemon off;'` and exposed port 80
# until commit 28258b5 ("fix docker port"), which dropped nginx and made the
# Next standalone server the container's only process on port 3000. Nothing
# installs nginx any more, and .dockerignore excludes this file from the build
# context, so editing it CANNOT affect production — the TLS termination and
# reverse proxy in front of the container are Dokploy's Traefik, configured in
# the Dokploy dashboard, not here.
#
# That matters when a 502 Bad Gateway shows up: this file is the obvious place
# to look and the wrong one. A 502 means Traefik had no healthy container to
# proxy to. Check the container's log for `[loyaly] configuration problem` and
# `GET /api/health` first.
# ─────────────────────────────────────────────────────────────────────────────
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
gzip on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
upstream nextjs_upstream {
server 127.0.0.1:3000;
}
server {
listen 80 3000;
server_name localhost;
# Serve Next.js compiled static assets directly via Nginx
location /_next/static/ {
alias /app/.next/static/;
expires 365d;
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# Serve public directory assets
location /public/ {
alias /app/public/;
expires 30d;
access_log off;
}
# Reverse proxy dynamic routes, SSR, and API routes to Next.js standalone server
location / {
proxy_pass http://nextjs_upstream;
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;
}
}
}