|
|
|
user www-data; |
|
worker_processes auto; |
|
worker_rlimit_nofile 51200; |
|
error_log /var/log/nginx/error.log crit; |
|
pid /var/run/nginx.pid; |
|
|
|
events { |
|
use epoll; |
|
worker_connections 51200; |
|
multi_accept on; |
|
} |
|
|
|
http { |
|
include mime.types; |
|
default_type application/octet-stream; |
|
client_max_body_size 1024m; |
|
|
|
|
|
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; |
|
|
|
|
|
gzip on; |
|
gzip_disable "msie6"; |
|
gzip_vary on; |
|
gzip_proxied any; |
|
gzip_comp_level 6; |
|
gzip_buffers 16 8k; |
|
gzip_http_version 1.1; |
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; |
|
|
|
|
|
proxy_cache_path /var/cache/nginx |
|
levels=1:2 |
|
keys_zone=nginx_cache:10m |
|
max_size=1g |
|
inactive=24h |
|
use_temp_path=off; |
|
|
|
|
|
server { |
|
listen 3000; |
|
server_name localhost; |
|
|
|
|
|
location /health { |
|
return 200 "OK"; |
|
} |
|
|
|
|
|
location / { |
|
proxy_pass http://127.0.0.1:3000; |
|
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_http_version 1.1; |
|
proxy_set_header Upgrade $http_upgrade; |
|
proxy_set_header Connection 'upgrade'; |
|
|
|
|
|
proxy_read_timeout 300s; |
|
proxy_send_timeout 300s; |
|
} |
|
|
|
|
|
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|eot)(.*) { |
|
proxy_pass http://127.0.0.1:3000; |
|
proxy_set_header Host $host; |
|
proxy_set_header X-Real-IP $remote_addr; |
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
|
|
|
|
add_header Cache-Control "public, max-age=31536000, immutable"; |
|
} |
|
|
|
|
|
location /api/models { |
|
proxy_cache nginx_cache; |
|
proxy_cache_key $request_uri; |
|
proxy_cache_valid 200 10m; |
|
proxy_cache_background_update on; |
|
proxy_cache_use_stale updating; |
|
proxy_cache_revalidate on; |
|
proxy_cache_min_uses 1; |
|
proxy_pass http://127.0.0.1:3000; |
|
add_header X-Cache-Status $upstream_cache_status; |
|
} |
|
|
|
|
|
location /api/check_version { |
|
proxy_pass http://127.0.0.1:3000; |
|
proxy_no_cache 1; |
|
} |
|
|
|
|
|
add_header X-Content-Type-Options "nosniff"; |
|
add_header X-Frame-Options "SAMEORIGIN"; |
|
add_header X-XSS-Protection "1; mode=block"; |
|
add_header Content-Security-Policy "default-src 'self';"; |
|
} |
|
} |