| |
|
|
| user nginx; |
| worker_processes auto; |
| error_log /var/log/nginx/error.log warn; |
| pid /var/run/nginx.pid; |
|
|
| events { |
| worker_connections 1024; |
| use epoll; |
| multi_accept on; |
| } |
|
|
| http { |
| include /etc/nginx/mime.types; |
| default_type application/octet-stream; |
|
|
| |
| log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
| '$status $body_bytes_sent "$http_referer" ' |
| '"$http_user_agent" "$http_x_forwarded_for"'; |
|
|
| access_log /var/log/nginx/access.log main; |
|
|
| |
| sendfile on; |
| tcp_nopush on; |
| tcp_nodelay on; |
| keepalive_timeout 65; |
| types_hash_max_size 2048; |
| client_max_body_size 16M; |
|
|
| |
| gzip on; |
| gzip_vary on; |
| gzip_min_length 1024; |
| gzip_proxied any; |
| gzip_comp_level 6; |
| gzip_types |
| text/plain |
| text/css |
| text/xml |
| text/javascript |
| application/json |
| application/javascript |
| application/xml+rss |
| application/atom+xml |
| image/svg+xml; |
|
|
| |
| add_header X-Frame-Options DENY; |
| add_header X-Content-Type-Options nosniff; |
| add_header X-XSS-Protection "1; mode=block"; |
| add_header Referrer-Policy "strict-origin-when-cross-origin"; |
|
|
| server { |
| listen 80; |
| server_name localhost; |
| root /usr/share/nginx/html; |
| index index.html index.htm; |
|
|
| |
| server_tokens off; |
|
|
| |
| location / { |
| try_files $uri $uri/ /index.html; |
| expires 1h; |
| add_header Cache-Control "public, immutable"; |
| } |
|
|
| |
| location /api/ { |
| proxy_pass http://app:8000; |
| 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_connect_timeout 30s; |
| proxy_send_timeout 30s; |
| proxy_read_timeout 30s; |
| |
| |
| proxy_buffering on; |
| proxy_buffer_size 4k; |
| proxy_buffers 8 4k; |
| } |
|
|
| |
| location /health { |
| proxy_pass http://app:8000/health; |
| 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; |
| |
| access_log off; |
| } |
|
|
| |
| location /ws { |
| proxy_pass http://app:8000; |
| 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_set_header X-Forwarded-Proto $scheme; |
| } |
|
|
| |
| location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { |
| expires 1y; |
| add_header Cache-Control "public, immutable"; |
| access_log off; |
| } |
|
|
| |
| location ~ /\. { |
| deny all; |
| access_log off; |
| log_not_found off; |
| } |
|
|
| |
| error_page 404 /404.html; |
| error_page 500 502 503 504 /50x.html; |
| |
| location = /50x.html { |
| root /usr/share/nginx/html; |
| } |
| } |
| } |