centos nginx页面内页都是404

解决您在不同平台环境下遇到的安装和升级问题
回复
linmufeng
帖子: 4
注册时间: 2017年 6月 27日 11:43

centos nginx页面内页都是404

帖子 linmufeng »

centos nginx页面内页都是404,这么简单的东西怎么这么费劲

代码: 全选

server
    {
        listen 80 default_server;
        #listen [::]:80 default_server ipv6only=on;
        server_name _;
        index index.html index.htm index.php;
        root  /home/wwwroot/;

        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
        if (!-e $request_filename) {
          rewrite ^(.*)$ /index.php$1 last;
        }
        #include enable-php.conf;
        include enable-php-pathinfo.conf;
        include typecho.conf;
        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }
        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }
         if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
         }
 
        location ~ .*\.php(\/.*)*$ {
            set $path_info "";
            set $real_script_name $fastcgi_script_name;
            if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                    set $real_script_name $1;
                    set $path_info $2;
            }
            fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
            fastcgi_param SCRIPT_NAME $real_script_name;
            fastcgi_param PATH_INFO $path_info;
            include fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
        }
        #location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        #{
        #    expires      30d;
        #}

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            allow all;
        }
TheStack
帖子: 2
注册时间: 2017年 7月 3日 22:15

Re: centos nginx页面内页都是404

帖子 TheStack »

看配置文件,有重复的部分,这应该是导致伪静态没生效的主要原因。
回复