使用nginx后伪静态出问题,不支持伪静态的路径访问了

发布于 2024-11-13 12:44:18

使用nginx后伪静态出问题,不支持伪静态的路径访问了。例如:http://127.0.0.1/cms/ 不支持这样访问了

查看更多

关注者
0
被浏览
66
1 个回答
feige
feige 2024-11-13
分享运营真实案例,用编程创造自己的产品

使用nginx后伪静态出问题,要配置

server {        listen       9001;
        server_name  www.ff.com *.ff.com;
        root   "D:\2.work\fastadmin\1.2.0.20201008_full\public";
        client_max_body_size     300m;
        client_header_timeout    5m;
        client_body_timeout      5m;
        proxy_connect_timeout     6000s;
        proxy_read_timeout      5m;
        proxy_send_timeout      5m;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
       location / {
            index  index.html index.htm index.php;
            #主要是这一段一定要确保存在
            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
                break;
            }
            #结束
            #autoindex  on;
        }
        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;

        }
    }

关键是这段

location / {
            index  index.html index.htm index.php;
            #主要是这一段一定要确保存在
            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
                break;
            }
            #结束
            #autoindex  on;
        }

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览