mirror of
https://gitee.com/maimengcloud/xm-ui-web.git
synced 2025-12-30 10:12:26 +00:00
docker
This commit is contained in:
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
# 使用官方的 Nginx 镜像作为基础镜像
|
||||
FROM m.daocloud.io/docker.io/nginx:alpine
|
||||
|
||||
|
||||
# 将自定义的 Nginx 配置文件复制到容器内
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# 将打包好的前端文件复制到 Nginx 的 html 目录
|
||||
COPY dist-prod/ /usr/share/nginx/html/
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 8067
|
||||
|
||||
# 启动 Nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
55
nginx.conf
Normal file
55
nginx.conf
Normal file
@@ -0,0 +1,55 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user