phpstudy的ngix伪静态设置

原创 LittleRob  2019-06-13 20:37:40  阅读 58 次 评论 0 条
摘要:

开始在nginx中修改配置总是不行。终于发现不能在nginx的配置文件中直接加rewrite规则,否则nginx无法启动,在vhost.conf配置文件中更改才行。

不能在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;
}
}


本文地址:https://www.myexplor.me/random/174php.html
版权声明:本文为原创文章,版权归 LittleRob 所有,欢迎分享本文,转载请保留出处!

发表评论

还没有留言,还不快点抢沙发?