|
| 1 | +user nginx; |
| 2 | +worker_processes auto; |
| 3 | + |
| 4 | +error_log /var/log/nginx/error.log notice; |
| 5 | +pid /var/run/nginx.pid; |
| 6 | + |
| 7 | + |
| 8 | +events { |
| 9 | + worker_connections 1024; |
| 10 | +} |
| 11 | + |
| 12 | +http { |
| 13 | + include /etc/nginx/mime.types; |
| 14 | + default_type application/octet-stream; |
| 15 | + |
| 16 | + log_format json_combined escape=json |
| 17 | + '{' |
| 18 | + '"timestamp":"$msec",' |
| 19 | + '"address":"$remote_addr",' |
| 20 | + '"request":"$request",' |
| 21 | + '"body_bytes_sent":$body_bytes_sent,' |
| 22 | + '"response_status":$status,' |
| 23 | + '"http_user_agent":"$http_user_agent"' |
| 24 | + '}'; |
| 25 | + |
| 26 | + access_log /var/log/nginx/access.log json_combined; |
| 27 | + |
| 28 | + sendfile on; |
| 29 | + |
| 30 | + keepalive_timeout 65; |
| 31 | + |
| 32 | + include /etc/nginx/conf.d/*.conf; |
| 33 | + |
| 34 | + server { |
| 35 | + listen 80; |
| 36 | + server_name localhost; |
| 37 | + client_max_body_size 100M; |
| 38 | + |
| 39 | + location ^~ /api/internal { # Blocks external access to /api/internal/* |
| 40 | + return 404; |
| 41 | + } |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + location / { |
| 46 | + root /usr/share/nginx/html; |
| 47 | + index index.html index.htm; |
| 48 | + try_files $uri /index.html; # forward all requests to the index.html for react |
| 49 | + } |
| 50 | + |
| 51 | + location /api { |
| 52 | + try_files $uri @backend; |
| 53 | + } |
| 54 | + |
| 55 | + location @backend { |
| 56 | + proxy_pass http://backend; |
| 57 | + proxy_set_header X-Real-IP $remote_addr; |
| 58 | + proxy_set_header Host $host; |
| 59 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 60 | + proxy_read_timeout 3600; |
| 61 | + proxy_connect_timeout 3600; |
| 62 | + proxy_send_timeout 3600; |
| 63 | + send_timeout 3600; |
| 64 | + } |
| 65 | + } |
| 66 | +} |
0 commit comments