zhibo/Log/6-nginx配置.md

40 lines
963 B
Markdown
Raw Normal View History

# 管理后台配置 (30002端口)
server {
listen 30002;
listen [::]:30002;
server_name 1.15.149.240;
charset utf-8;
# 网站根目录 - 前端静态文件
root /www/wwwroot/1.15.149.240_30002;
index index.html;
# 前端路由支持
location / {
try_files $uri $uri/ /index.html;
}
# API代理到后端 Admin API (30003端口)
location /api/ {
proxy_pass http://127.0.0.1:30003;
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 ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 12h;
access_log off;
}
access_log /www/wwwlogs/1.15.149.240_30002.log;
error_log /www/wwwlogs/1.15.149.240_30002.error.log;
}