前提:已经拉取或导入镜像
注:如下参数,根据实际端口,路径修改
挂载nginx配置文件 -v /home/user/nginx/conf.d:/etc/nginx/conf.d
挂载静态资源 -v /home/user/efm-ui:/efm-ui,这个地址和下文中的nginx配置文件中的路径保持一致,才能找到静态资源。
docker run -it -d \--name nginx \--restart=always \-p 9020:9020 \-v /home/user/nginx/conf.d:/etc/nginx/conf.d \-v /home/user/efm-ui:/efm-ui \nginx:1.21.6
conf.d文件夹下的配置文件
efm-ui.conf内容如下:
注:下文中的 root /efm-ui/9020/dist/路径需在容器挂载路径之下
server {listen 9020;server_name localhost;root /efm-ui/9020/dist/;location ~* ^/(code|auth|admin|gen|daemon|tx|act|monitor|mp|job|pay|ecms|acctinsp|gzno|equi|exam|prew|epms|knowledge|daily|prem|flowable) {proxy_pass http://127.0.0.1:9998;#proxy_set_header Host $http_host;proxy_connect_timeout 300s;client_max_body_size 20m;proxy_send_timeout 300s;proxy_read_timeout 300s;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}location ^~ /examfile/ {proxy_pass http://192.168.1.91:9000;proxy_set_header Host $host;proxy_set_header X-Forwarded-Proto $scheme;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;rewrite ^/examfile/(.*) /$1 break;}location /minio {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_pass http://127.0.0.1:9000;client_max_body_size 50m;}}
