user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /run/nginx.pid; events { worker_connections 1024; 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" ' '$request_time $upstream_response_time $upstream_status'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; keepalive_requests 100; types_hash_max_size 2048; resolver 127.0.0.11 valid=300s; resolver_timeout 5s; client_max_body_size 50m; client_body_buffer_size 128k; client_header_buffer_size 1k; large_client_header_buffers 4 4k; gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml; gzip_comp_level 6; gzip_buffers 4 16k; limit_req_zone $binary_remote_addr zone=api_limit:10m rate=100r/s; limit_req_zone $binary_remote_addr zone=web_limit:10m rate=50r/s; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header X-Robots-Tag "none" always; map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream api-gateway-backend { server api-gateway:8080 max_fails=3 fail_timeout=30s; keepalive 32; } upstream jenkins-backend { server jenkins:8099 max_fails=3 fail_timeout=30s; keepalive 16; } server { listen 80; server_name www.fengzhongxing.com; root /usr/share/nginx/html; index index.html; location /official/ { try_files $uri $uri/ /official/index.html; } location ~* ^/official/.*\.(js|css|json|svg|png|jpg|jpeg|gif|ico|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; add_header Vary "Accept-Encoding"; } location /api/ { limit_req zone=api_limit burst=20 nodelay; proxy_pass http://api-gateway-backend; 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 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; } location / { return 301 /official/; } } server { listen 80; server_name platform.fengzhongxing.com; root /usr/share/nginx/html; index index.html; location /platform/ { try_files $uri $uri/ /platform/index.html; } location ~* ^/platform/.*\.(js|css|json|svg|png|jpg|jpeg|gif|ico|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; add_header Vary "Accept-Encoding"; } location /api/ { limit_req zone=api_limit burst=20 nodelay; proxy_pass http://api-gateway-backend; 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 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; } location /ws/ { proxy_pass http://api-gateway-backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_read_timeout 86400; } location / { return 301 /platform/; } } server { listen 80; server_name merchant.fengzhongxing.com; root /usr/share/nginx/html; index index.html; location /merchant/ { try_files $uri $uri/ /merchant/index.html; } location ~* ^/merchant/.*\.(js|css|json|svg|png|jpg|jpeg|gif|ico|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; add_header Vary "Accept-Encoding"; } location /api/ { limit_req zone=api_limit burst=20 nodelay; proxy_pass http://api-gateway-backend; 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 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; } location /ws/ { proxy_pass http://api-gateway-backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_read_timeout 86400; } location / { return 301 /merchant/; } } server { listen 80; server_name h5.fengzhongxing.com; root /usr/share/nginx/html; index index.html; location /h5/ { try_files $uri $uri/ /h5/index.html; } location ~* ^/h5/.*\.(js|css|json|svg|png|jpg|jpeg|gif|ico|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; add_header Vary "Accept-Encoding"; } location /api/ { limit_req zone=api_limit burst=20 nodelay; proxy_pass http://api-gateway-backend; 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 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; } location /ws/ { proxy_pass http://api-gateway-backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_read_timeout 86400; } location / { return 301 /h5/; } } server { listen 80; server_name rider.fengzhongxing.com; root /usr/share/nginx/html; index index.html; location /rider/ { try_files $uri $uri/ /rider/index.html; } location ~* ^/rider/.*\.(js|css|json|svg|png|jpg|jpeg|gif|ico|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; add_header Vary "Accept-Encoding"; } location /api/ { limit_req zone=api_limit burst=20 nodelay; proxy_pass http://api-gateway-backend; 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 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; } location /ws/ { proxy_pass http://api-gateway-backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_read_timeout 86400; } location / { return 301 /rider/; } } server { listen 80; server_name api.fengzhongxing.com; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS,PATCH; add_header Access-Control-Allow-Headers Content-Type,Authorization,token,x-request-start,x-request-id,x-request-time,x-user-id,x-app-id; add_header Access-Control-Expose-Headers Authorization,token; if ($request_method = OPTIONS) { return 204; } location /api/ { limit_req zone=api_limit burst=50 nodelay; proxy_pass http://api-gateway-backend; 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 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; } location /ws/ { proxy_pass http://api-gateway-backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_read_timeout 86400; } location /actuator/ { proxy_pass http://api-gateway-backend; proxy_set_header Host $host; } } server { listen 80; server_name monitor.fengzhongxing.com; location /prometheus/ { set $prometheus_backend "prometheus:9090"; proxy_pass http://$prometheus_backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /grafana/ { set $grafana_backend "grafana:3000"; proxy_pass http://$grafana_backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /skywalking/ { set $skywalking_backend "skywalking-ui:8080"; proxy_pass http://$skywalking_backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } server { listen 80; server_name jenkins.fengzhongxing.com; location / { proxy_pass http://jenkins-backend; 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_buffering off; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; } } server { listen 80 default_server; server_name _; location / { return 302 http://www.fengzhongxing.com; } } }