java-analysis/nginx.conf

71 lines
1.7 KiB
Nginx Configuration File

#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
client_max_body_size 128m; #请求体的阈值
#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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html; # 替换为 Vue 应用的构建输出目录
index index.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# 普通接口
location ^~ /dev-api {
proxy_pass http://upload-backend:8880;
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_set_header Connection "";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
rewrite ^/dev-api/(.*)$ /$1 break;
}
location /static/ {
alias /usr/share/nginx/html/static/;
}
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
}