server { listen 80; root /var/www/rongxing/server/public; server_name api.rongxinweilai.com; index index.php index.html index.htm; location / { if (!-e $request_filename) { rewrite ^/index.php(.*)$ /index.php?s=$1 last; rewrite ^(.*)$ /index.php?s=$1 last; break; } } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; #fastcgi_pass php:9000; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } # 图片资源重定向 location ^~ /upload/ { add_header 'Access-Control-Allow-Origin' '*'; #允许来自所有的访问地址 add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS'; #支持请求方式 add_header 'Access-Control-Allow-Headers' 'Content-Type,*'; proxy_pass http://admin.rongxinweilai.com/upload/; } access_log /var/log/nginx/jiurong_access.log; error_log /var/log/nginx/jiurong_error.log; } server { listen 80; root /var/www/rongxing-admin/public; server_name admin.rongxinweilai.com; index index.php index.html index.htm; location / { if (!-e $request_filename) { rewrite ^/admin.php(.*)$ /admin.php?s=$1 last; rewrite ^(.*)$ /index.php?s=$1 last; break; } } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; #fastcgi_pass php:9000; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } access_log /var/log/nginx/jiurong_admin_access.log; error_log /var/log/nginx/jiurong_admin_error.log; }
nginx 二级域名配置
最新推荐文章于 2023-06-15 08:03:07 发布