MICUU
心情
所有
图集
登录
搜索
原创
nginx设置同一域名访问不同目录,centos下vhost一般所在目录
感觉没feel
发布于:2021-09-13
nginx设置访问二级目录作为一个新项目的方法,主要逻辑是下方的9-14行,主要实现的逻辑是 a.com访问的是项目一 a.com/ss 访问的是项目二。 ``` /etc/nginx/conf.d //centos下vhost一般所在目录 server { listen 80; server_name localhost; #root /usr/share/nginx/html/charge/public; index index.php index.html index.htm; set $rootdir "/usr/share/nginx/html/charge/public/"; if ($request_uri ~ "/service_msg") { set $rootdir "/usr/share/nginx/html/after_sale_api/public/"; rewrite "^(/service_msg/){1}(.*)$" /$2 last; break; } root $rootdir; #charset koi8-r; access_log /var/log/nginx/charge.access.log main; if ($http_Host !~* ^weixin101.dsaadsa.com.cn$) { return 403; } location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ ^/(uploads|assets|template|static|download|swg)/.*\.(php|php5|php7|jsp)$ { deny all; } location ~ \.php(.*)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } } ```
注:原创不易,转载请注明出处(
https://micuu.com/new/2077.html
),本站所有资源来源于网络收集,如有侵权请联系QQ245557979进行清除。
最后修改与 2022-02-18
上一篇:
phalapi框架header头验证合法性
下一篇:
systemctl来重启Linux服务器的Nginx及其他服务
留言反馈
请先登录
问题反馈渠道,如有软件无法下载或者其他问题可反馈。【由于某种原因,目前留言不展示】
用户需要登录后才能留言反馈
立即留言
珍藏视频
10分钟高效燃脂
30天高效瘦脸操
5分钟缓解颈椎操
友人
微博
全民K歌
唱吧
今日头条
悠悠网
科技小锅盖
彼岸桌面
阮一峰
laravel社区
V2ex
掘金
更多>