server { listen 80; server_name _; root /var/www/html/public; index index.html index.php; charset utf-8; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # WebSocket proxy - must come before generic proxy rules location /ws { proxy_pass http://php:20108; proxy_http_version 1.1; 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_read_timeout 86400; } # Admin management frontend (Vue SPA) location /admin { alias /var/www/html/public/admin; try_files $uri $uri/ /admin/index.html; index index.html; } # Demo pages (user-side chat) location /demo { alias /var/www/html/public/demo; try_files $uri $uri/ /demo/index.html; index index.html; } # Install wizard static assets (CSS/JS/images) location /install/statics { alias /var/www/html/public/install; } # Static assets location /statics { alias /var/www/html/public/statics; } # Favicon location = /favicon.ico { alias /var/www/html/public/favicon.ico; } # All other requests proxy to Swoole (ThinkPHP handles routing) location / { proxy_pass http://php:20108; proxy_http_version 1.1; 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_read_timeout 300; } }