From 8054c4b93ddd8ea0146f10effa4b3722a895b5a0 Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Mon, 22 Dec 2025 19:57:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 73 +++++++++++++++++++++++++++++++++- Dockerfile | 7 ++++ nginx.conf | 97 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1ac928b..0a71c22 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,4 +1,75 @@ - {} + + + + + + + + { + "associatedIndex": 0 +} + + + + { + "keyToString": { + "ModuleVcsDetector.initialDetectionPerformed": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.git.unshallow": "true", + "RunOnceActivity.typescript.service.memoryLimit.init": "true", + "git-widget-placeholder": "master", + "javascript.preferred.runtime.type.id": "node", + "last_opened_file_path": "E:/code/intc/front-end/intc-single-ultra-web", + "node.js.detected.package.eslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "nodejs_package_manager_path": "npm", + "vue.rearranger.settings.migration": "true" + } +} + + + + + + + + + + 1766374899115 + + + + + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..edaaf77 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM nginx:1.29.1 + +COPY dist/ /usr/share/nginx/html/ + +COPY nginx.conf /etc/nginx/nginx.conf + +RUN echo 'echo init ok!!' diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..b5eaadb --- /dev/null +++ b/nginx.conf @@ -0,0 +1,97 @@ +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + # 限制body大小 + client_max_body_size 100m; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + upstream server { + ip_hash; + # gateway 地址 + server 117.72.197.29:8091; + # server 127.0.0.1:8081; + } + + server { + listen 80; + server_name localhost; + + # https配置参考 start + #listen 443 ssl; + + # 证书直接存放 /docker/nginx/cert/ 目录下即可 更改证书名称即可 无需更改证书路径 + #ssl on; + #ssl_certificate /etc/nginx/cert/xxx.local.crt; # /etc/nginx/cert/ 为docker映射路径 不允许更改 + #ssl_certificate_key /etc/nginx/cert/xxx.local.key; # /etc/nginx/cert/ 为docker映射路径 不允许更改 + #ssl_session_timeout 5m; + #ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; + #ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + #ssl_prefer_server_ciphers on; + # https配置参考 end + + # 演示环境配置 拦截除 GET POST 之外的所有请求 + # if ($request_method !~* GET|POST) { + # rewrite ^/(.*)$ /403; + # } + + # location = /403 { + # default_type application/json; + # return 200 '{"msg":"演示模式,不允许操作","code":500}'; + # } + + # 限制外网访问内网 actuator 相关路径 + location ~ ^(/[^/]*)?/actuator.*(/.*)?$ { + return 403; + } + + location / { + root /usr/share/nginx/html; # docker映射路径 不允许更改 + try_files $uri $uri/ /index.html; + index index.html index.htm; + 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; + } + + location /prod-api/ { + # websocket参数 + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + rewrite ^/prod-api/(.*) /$1 break; + proxy_pass http://server; + } + + location /file/ { + rewrite ^/file/(.*) /$1 break; + proxy_pass http://140.249.24.92:9000; + } + + location /model/ { + rewrite ^/model/(.*) /$1 break; + proxy_pass http://140.249.24.92:3101; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + } +}