first commit
This commit is contained in:
9
docker/Dockerfile
Normal file
9
docker/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/nginx
|
||||
|
||||
COPY ./dist /data
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
ADD ymt-ui.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
RUN /bin/bash -c 'echo init ok'
|
||||
19
docker/docker-compose.yaml
Normal file
19
docker/docker-compose.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: '3'
|
||||
services:
|
||||
ymt-ui:
|
||||
build:
|
||||
context: .
|
||||
restart: always
|
||||
container_name: ymt-ui
|
||||
image: ymt-ui
|
||||
networks:
|
||||
- spring_cloud_default
|
||||
external_links:
|
||||
- ymt-gateway
|
||||
ports:
|
||||
- 80:80
|
||||
|
||||
# 加入到后端网络, 默认为 ymt_default | docker network ls 查看
|
||||
networks:
|
||||
spring_cloud_default:
|
||||
external: true
|
||||
39
docker/ymt-ui.conf
Normal file
39
docker/ymt-ui.conf
Normal file
@@ -0,0 +1,39 @@
|
||||
server_tokens off; # Nginx 版本信息关闭,避免攻击
|
||||
client_max_body_size 64m; # 最大上传文件大小!
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
gzip on;
|
||||
gzip_static on; # 需要http_gzip_static_module 模块
|
||||
gzip_min_length 1k;
|
||||
gzip_comp_level 4;
|
||||
gzip_proxied any;
|
||||
gzip_types text/plain text/xml text/css;
|
||||
gzip_vary on;
|
||||
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
||||
|
||||
# 前端打包好的dist目录文件
|
||||
root /data/;
|
||||
|
||||
location ^~/api/ {
|
||||
proxy_pass http://tzfz-gateway:9999/; #注意/后缀
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 120s;
|
||||
proxy_send_timeout 120s;
|
||||
proxy_set_header from "";
|
||||
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 http;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header from "";
|
||||
}
|
||||
|
||||
# 屏蔽所有敏感路径,不用改代码配置开关,双重保护
|
||||
location ~* ^/(actuator|swagger-ui|v3/api-docs|swagger-resources|webjars|doc.html) {
|
||||
return 403; # 禁止访问
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user