首页 > 代码库 > nginx配置
nginx配置
1、nginx隐藏index.php
下面是虚拟主机隐藏index.php的一个案例,其中红色的就是隐藏index.php
server { listen 80; server_name www.sand.com alias sand.com; location / { root D:/sandbox_pro/sandbox; if ( -f $request_filename/index.php) { rewrite (.*) $1/index.php; } if ( !-f $request_filename ) { rewrite (.*) /index.php; } index index.html index.htm default.html default.htm index.php default.php app.php u.php; include D:/sandbox_pro/sandbox/up-*.conf; } autoindex off; include advanced_settings.conf; location ~ ^.+\.php { root D:/sandbox_pro/sandbox; fastcgi_pass bakend; 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.conf; } }#server www.sand.com end}
nginx配置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。