From e39982c6f5d1bc8c31a969d9a0520960925dfbc5 Mon Sep 17 00:00:00 2001 From: Huangzhe Date: Tue, 27 May 2025 21:16:54 +0800 Subject: [PATCH 1/2] update nginx --- docker/nginx.conf | 91 ++++++++++++++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 32 deletions(-) diff --git a/docker/nginx.conf b/docker/nginx.conf index 7d69915..224da30 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -1,35 +1,62 @@ -server { - listen 80 default_server; - server_name _; +worker_processes 1; - #charset koi8-r; - #access_log /var/log/nginx/host.access.log main; - - # 跳转到伊利GPT - # 反向代理配置 - location /aiagent/ { - proxy_pass https://yiligpt.x.digitalyili.com; - proxy_set_header Host yiligpt.x.digitalyili.com; - 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 $scheme; - - # 如果需要忽略SSL证书验证(测试环境) - # proxy_ssl_verify off; - } - - - location / { - root /var/www/html; - index index.html index.htm; - try_files $uri $uri/ //index.html; - } - - - # redirect server error pages to the static page /50x.html - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /var/www/html; - } +# 错误日志配置 +error_log /var/log/nginx/error.log info; +pid /var/run/nginx.pid; +events { + worker_connections 1024; } + +http { + # 访问日志格式定义 + 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; + server { + listen 80 default_server; + server_name _; + + #charset koi8-r; + access_log /var/log/nginx/host.access.log main; + + location / { + root /var/www/html; + index index.html index.htm; + try_files $uri $uri/ //index.html; + } + + # 跳转到伊利GPT + # 反向代理配置 + location /aiagent/ { + proxy_pass https://yiligpt.x.digitalyili.com; + proxy_set_header Host yiligpt.x.digitalyili.com; + 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 $scheme; + + # 如果需要忽略SSL证书验证(测试环境) + # proxy_ssl_verify off; + } + + + + # redirect server error pages to the static page /50x.html + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /var/www/html; + } + + # 提供日志文件访问 + location /logs { + alias /var/log/nginx/; + autoindex on; + # 安全设置,根据需要取消注释 + # auth_basic "Restricted Access"; + # auth_basic_user_file /etc/nginx/.htpasswd; + } + } +} \ No newline at end of file From 4d13a28eb270a62868c23d418e3b9b5b5a6bb2a0 Mon Sep 17 00:00:00 2001 From: Huangzhe Date: Tue, 27 May 2025 21:34:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor/nginx:=20=E9=87=8D=E6=9E=84=20NGIN?= =?UTF-8?q?X=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -移除了不必要的全局配置,简化了配置文件结构 - 删除了未使用的日志格式和访问日志配置 - 移除了反向代理和日志文件访问相关配置 - 保留了基本的服务器配置和错误页面配置 --- docker/nginx.conf | 77 +++++++++++------------------------------------ 1 file changed, 18 insertions(+), 59 deletions(-) diff --git a/docker/nginx.conf b/docker/nginx.conf index 224da30..b65ea3a 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -1,62 +1,21 @@ -worker_processes 1; +server { + listen 80 default_server; + server_name _; -# 错误日志配置 -error_log /var/log/nginx/error.log info; -pid /var/run/nginx.pid; + #charset koi8-r; + #access_log /var/log/nginx/host.access.log main; -events { - worker_connections 1024; -} - -http { - # 访问日志格式定义 - 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; - server { - listen 80 default_server; - server_name _; - - #charset koi8-r; - access_log /var/log/nginx/host.access.log main; - - location / { - root /var/www/html; - index index.html index.htm; - try_files $uri $uri/ //index.html; - } - - # 跳转到伊利GPT - # 反向代理配置 - location /aiagent/ { - proxy_pass https://yiligpt.x.digitalyili.com; - proxy_set_header Host yiligpt.x.digitalyili.com; - 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 $scheme; - - # 如果需要忽略SSL证书验证(测试环境) - # proxy_ssl_verify off; - } - - - - # redirect server error pages to the static page /50x.html - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /var/www/html; - } - - # 提供日志文件访问 - location /logs { - alias /var/log/nginx/; - autoindex on; - # 安全设置,根据需要取消注释 - # auth_basic "Restricted Access"; - # auth_basic_user_file /etc/nginx/.htpasswd; - } + location / { + root /var/www/html; + index index.html index.htm; + try_files $uri $uri/ //index.html; } -} \ No newline at end of file + + + # redirect server error pages to the static page /50x.html + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /var/www/html; + } + +}