From 927b162255a1c4d52dc67c5b0b9fbcd8fc373d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Wed, 6 Mar 2024 17:14:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 ++++++ nginx.conf | 53 ++++++++++++++++++++++++++++++++++++++++++++ src/static/config.js | 4 ++-- 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..9fdae23c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +# 设置基础镜像 +FROM nginx:WIN-1.25.3 + +WORKDIR /opt/sfms3.0-uniapp +COPY nginx.conf /usr/local/nginx/conf/nginx.conf +# 将dist/build/h5/文件中的内容复制到 /opt/sfms3.0-uniapp 这个目录下面 +COPY dist/build/h5/ /opt/sfms3.0-uniapp diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..04e4b8a9 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,53 @@ +user root; +worker_processes 2; + +events { + worker_connections 1024; +} + +http { + include mime.types; + charset utf-8,gbk; + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for" "$request_time $upstream_response_time"'; + + proxy_cache_path /opt/nginx_cache/ levels=1:2 keys_zone=my_zone:10m inactive=300s max_size=5g; + access_log logs/access.log main; + sendfile on; + #tcp_nopush on; + keepalive_timeout 600s; + client_max_body_size 200m; + gzip on; + gzip_min_length 10k; + gzip_comp_level 9; + gzip_buffers 4 16k; + gzip_types text/plain application/javascript text/css application/xml text/javascript image/jpeg image/gif image/png; + gzip_vary on; + gzip_disable "MSIE [1-6]\."; + upstream sfms3.0 { + server localhost:25310 weight=10 max_fails=3 fail_timeout=10s; + } + server { + listen 25302; + server_name_in_redirect off; + server_name dev.ccwin-in.com; + location /api/ { + proxy_pass http://sfms3.0/; + proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header; + proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $http_x_forwarded_for; + } + location / { + proxy_cache my_zone; + proxy_cache_valid 200 304 12h; + proxy_cache_key $host$uri$is_args$args; + try_files $uri $uri/ /index.html; + root /opt/sfms3.0-uniapp; + index index.html index.htm; + } + } +} \ No newline at end of file diff --git a/src/static/config.js b/src/static/config.js index ab11b5ae..612c4d5d 100644 --- a/src/static/config.js +++ b/src/static/config.js @@ -1,5 +1,5 @@ -let request_url = "http://192.168.0.211:12080/admin-api" -// let request_url = "http://dev.ccwin-in.com:25100/api/admin-api" +let request_url = "http://dev.ccwin-in.com:25300/api/admin-api" +// let request_url = "http://192.168.0.211:12080/admin-api" let isDevelopment = false