phpstudy2016 ngix伪静态设置方法

2022-11-06  阅读 834 次

Apache下的伪静态配置下比较简单,ReWrite规则里面直接选择创建.htaccess即可,只要权限没什么问题,检查.htaccess文件存在,那么这个伪静态就算是完成了。

Nginx下的伪静态稍微复杂一点点。

phpstudy2016的不能在nginx的配置文件中直接加rewrite规则,否则nginx无法启动,在vhost.conf配置文件中更改才行,如苹果CMS10 Nginx下的伪静态 内容如下:

server {
        listen       80;
        server_name  www.yaaibk.com ;
        root   "E:/www/www_tv";
        location / {
            index  index.html index.htm index.php;
            #autoindex  on;
 if (!-e $request_filename) {
        rewrite ^/index.php(.*)$ /index.php?s=$1 last;
        rewrite ^/admin.php(.*)$ /admin.php?s=$1 last;
        rewrite ^/api.php(.*)$ /api.php?s=$1 last;
        rewrite ^(.*)$ /index.php?s=$1 last;
        break;
   }

        }
        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;
        }
}

具体如下图:

yaaibk_202211061352-26.png


yaaibk_202211061353-50.png



本文地址:http://yaaibk.com/post/305.html
版权声明:本文为原创文章,版权归 本站 所有,欢迎分享本文,转载请保留出处!

评论已关闭!