WeiYoun

We young,we try,we fly

phpstudy的ngix伪静态设置

不能在nginx的配置文件中直接加rewrite规则,否则nginx无法启动,在vhost.conf配置文件中更改才行,内容如下:
server {
listen       7777;
server_name  www.1111.com 1111.com;
root   "E:\wwwroot\feehi525backup\feehi\frontend\web";
location / {
index  index.html index.htm index.php;
#autoindex  on;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
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;
}
}


发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

© ©2018-2021 Copyright Weiyoun.

本站会分享一些资源,可按需下载;还有一些建站经验及有趣的文章分享,欢迎常来!