From de27a23b4f4a6b8d934ae0889f10a3d7f041c80b Mon Sep 17 00:00:00 2001 From: luorijun Date: Thu, 12 Feb 2026 16:36:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=AD=E6=B3=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.php | 10 +++++----- nginx.conf | 19 ++++++++----------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/config/config.php b/config/config.php index e8b0d42..7a612d3 100644 --- a/config/config.php +++ b/config/config.php @@ -16,19 +16,19 @@ return [ // 数据库连接 'db' => [ - 'host' => '127.0.0.1', + 'host' => 'mysql', 'port' => 3306, 'dbname' => 'hualianyun', 'username' => 'root', - 'password' => 'qaz123!@#', + 'password' => '123456789', ], // 线上数据库连接 'formal_db' => [ - 'host' => '127.0.0.1', + 'host' => 'mysql', 'port' => 3306, 'dbname' => 'hualianyun', 'username' => 'root', - 'password' => 'qaz123!@#', + 'password' => '123456789', ], //线上地址 'formal_origin' => [ @@ -58,7 +58,7 @@ return [ 'http://rg.jkip.com', 'http://http.wyk', 'http://taobao.juip.com', - 'http://register.wyk' + 'http://register.wyk', ], //支付宝 'alipay' => [ diff --git a/nginx.conf b/nginx.conf index ac473e2..2fc5b90 100644 --- a/nginx.conf +++ b/nginx.conf @@ -2,17 +2,6 @@ server { listen 9000; server_name _; - # CORS - add_header 'Access-Control-Allow-Origin' "$http_origin" always; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; - add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; - add_header 'Access-Control-Allow-Credentials' 'true' always; - - # pre-flight requests - if ($request_method = 'OPTIONS') { - return 204; - } - index index.php; root /var/www/html; @@ -29,5 +18,13 @@ server { rewrite ^(.*)$ /index.php?s=$1 last; break; } + + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + return 204; + } } } \ No newline at end of file