Nginx服务器无法实现伪静态化,在后台设置不成功

wdzsjl 8个月前 (02-03) 阅读数 120 #Typecho

错误提示:

Nginx服务器无法实现伪静态化,在后台设置不成功

解决方案:

这主要是nginx的rewrite没有设置导致的

在nginx.conf里找到网站的server配置段,一般我们推荐如下的配置

    server {
        listen          80;
        server_name     yourdomain.com;
        root            /home/yourdomain/www/;
        index           index.html index.htm index.php;
 
        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }
 
        location ~ .*\.php(\/.*)*$ {
            include fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
        }
 
        access_log logs/yourdomain.log combined;
    }

注意把以上配置中的yourdomain换成你自己的实际域名和实际目录存放地址


wx.jpg
热门