diff --git a/config/config.php b/config/config.php index 7a612d3..e8b0d42 100644 --- a/config/config.php +++ b/config/config.php @@ -16,19 +16,19 @@ return [ // 数据库连接 'db' => [ - 'host' => 'mysql', + 'host' => '127.0.0.1', 'port' => 3306, 'dbname' => 'hualianyun', 'username' => 'root', - 'password' => '123456789', + 'password' => 'qaz123!@#', ], // 线上数据库连接 'formal_db' => [ - 'host' => 'mysql', + 'host' => '127.0.0.1', 'port' => 3306, 'dbname' => 'hualianyun', 'username' => 'root', - 'password' => '123456789', + 'password' => 'qaz123!@#', ], //线上地址 '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 2fc5b90..ac473e2 100644 --- a/nginx.conf +++ b/nginx.conf @@ -2,6 +2,17 @@ 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; @@ -18,13 +29,5 @@ 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