Files
xm-ui-web/nginx.conf
陈裕财 20a5d6509e docker
2025-04-16 18:35:39 +08:00

55 lines
1.7 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 8014;
server_name _;
index index.html index.htm;
# 处理根目录请求
location ~ / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~ /api/lcode/ { ## 后端项目 - 管理后台
proxy_pass http://lcode-server:45916/; ## 重要proxy_pass 需要设置为后端项目所在服务器的 IP
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 65s;
proxy_send_timeout 65s;
proxy_read_timeout 65s;
proxy_next_upstream_tries 1;
}
location ^~ /api/xm/ { ## 后端项目 - 管理后台
proxy_pass http://xm-server:43518/; ## 重要proxy_pass 需要设置为后端项目所在服务器的 IP
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 65s;
proxy_send_timeout 65s;
proxy_read_timeout 65s;
proxy_next_upstream_tries 1;
}
# 防止访问以点(.)开头的文件,如 .DS_Store
location ~ /\. {
deny all;
return 404;
}
# 防止常见备份文件被访问
location ~* \.(bak|swp|DS_Store|git|env)$ {
deny all;
return 404;
}
# 防止 .well-known 之外的隐藏文件
location ~ /\.(?!well-known).* {
deny all;
return 404;
}
}