为了使用nginx环境,以前apache配置127.0.0.2是在vhost.conf文件中添加相关的虚拟主机,当前是通过配置nginx.conf文件。
1.隐去index.php需要在下面这段话中添加标红字段。
location / {
index index.html index.htm index.php l.php;
#autoindex on;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
2.添加127.0.0.2将上面的主机配置复制一遍,粘贴在server的下部,当前布置的rbac系统是放在了www文件夹下。
server {
listen 80;
server_name 127.0.0.2;
root "H:/phpstudy/PHPTutorial/WWW/rbac";
location / {
index index.html index.htm index.php l.php;
#autoindex on;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
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;
}
}