|
| 1 | +user user; |
| 2 | +pid /tmp/nginx.pid; |
| 3 | +worker_processes auto; |
| 4 | + |
| 5 | +events { |
| 6 | + worker_connections 1024; |
| 7 | +} |
| 8 | + |
| 9 | +http { |
| 10 | + include /etc/nginx/mime.types; |
| 11 | + default_type application/octet-stream; |
| 12 | + |
| 13 | + sendfile on; |
| 14 | + tcp_nopush on; |
| 15 | + tcp_nodelay on; |
| 16 | + keepalive_timeout 65; |
| 17 | + types_hash_max_size 4096; |
| 18 | + |
| 19 | + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
| 20 | + '$status $body_bytes_sent "$http_referer" ' |
| 21 | + '"$http_user_agent" "$http_x_forwarded_for"'; |
| 22 | + |
| 23 | + access_log /dev/stdout main; |
| 24 | + error_log /dev/stderr warn; |
| 25 | + |
| 26 | + map $http_upgrade $connection_upgrade { |
| 27 | + default upgrade; |
| 28 | + '' close; |
| 29 | + } |
| 30 | + |
| 31 | + upstream backend { |
| 32 | + server 127.0.0.1:7861; |
| 33 | + } |
| 34 | + |
| 35 | + server { |
| 36 | + listen 7860; |
| 37 | + listen [::]:7860; |
| 38 | + |
| 39 | + # Static assets for the landing/login shell |
| 40 | + location ^~ /shell-assets/ { |
| 41 | + alias /app/static/frontend-shell/shell-assets/; |
| 42 | + access_log off; |
| 43 | + expires 1y; |
| 44 | + add_header Cache-Control "public, immutable"; |
| 45 | + } |
| 46 | + |
| 47 | + # Static assets for the application bundle |
| 48 | + location ^~ /app-assets/ { |
| 49 | + alias /app/static/frontend-app/app-assets/; |
| 50 | + access_log off; |
| 51 | + expires 1y; |
| 52 | + add_header Cache-Control "public, immutable"; |
| 53 | + } |
| 54 | + |
| 55 | + location = / { |
| 56 | + root /app/static/frontend-shell; |
| 57 | + try_files $uri /index.html; |
| 58 | + } |
| 59 | + |
| 60 | + location = /login { |
| 61 | + root /app/static/frontend-shell; |
| 62 | + try_files $uri /index.html; |
| 63 | + } |
| 64 | + |
| 65 | + location = /organization { |
| 66 | + root /app/static/frontend-shell; |
| 67 | + try_files $uri /index.html; |
| 68 | + } |
| 69 | + |
| 70 | + location /api/ { |
| 71 | + proxy_pass http://backend; |
| 72 | + proxy_http_version 1.1; |
| 73 | + proxy_set_header Host $host; |
| 74 | + proxy_set_header X-Real-IP $remote_addr; |
| 75 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 76 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 77 | + proxy_set_header Upgrade $http_upgrade; |
| 78 | + proxy_set_header Connection $connection_upgrade; |
| 79 | + } |
| 80 | + |
| 81 | + location /health { |
| 82 | + proxy_pass http://backend/health; |
| 83 | + proxy_http_version 1.1; |
| 84 | + proxy_set_header Host $host; |
| 85 | + proxy_set_header X-Real-IP $remote_addr; |
| 86 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 87 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 88 | + } |
| 89 | + |
| 90 | + location / { |
| 91 | + root /app/static/frontend-app; |
| 92 | + try_files $uri /index.html; |
| 93 | + } |
| 94 | + } |
| 95 | +} |
0 commit comments