解决 ci yii 下nginx 404 错误

来源:互联网 发布:淘宝小号 不实名 购买 编辑:程序博客网 时间:2024/05/24 05:50
location ~ \.php { # 这里减掉一个“$”原本是\.php$
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php; # 这一句不知道什么用处
    fastcgi_split_path_info ^(.+\.php)(.*)$; # 加了这一句
    fastcgi_param PATH_INFO $fastcgi_path_info; # 还有这一句
    include fastcgi.conf;
}


yii----------------------------------------------

        location ~ \.php { # ......<93>$<94>...\.php$
         root  html;
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_index index.php; # ..........
         fastcgi_split_path_info ^(.+\.php)(.*)$; # ....
        # fastcgi_param PATH_INFO $fastcgi_path_info; # .....
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include fastcgi.conf;
        }
---------------------------------------------
nginx 配置

    server {
        listen       8080;
        server_name  192.168.1.168;
        root  html/e3m;


        location / {
            root   html/e3m;
            index  index.html index.php;
            if ($request_filename !~ (connect|gif|png|jpg|js|css|images|source|robots/.txt|index/.php.*) ) {
             rewrite ^/(.*)$ /index.php/$1 last;
             break;
            }
         }


        location ~* .(jpg|jpeg|gif|png|css|js|ico|xml)$ {
            access_log        off;
            log_not_found     off;
            expires           360d;
        }




        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root  html;
        }


        location ~ \.php { # ......<93>$<94>...\.php$
         root  html/e3m;
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_index index.php; # ..........
         fastcgi_split_path_info ^(.+\.php)(.*)$; # ....
        # fastcgi_param PATH_INFO $fastcgi_path_info; # .....
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include fastcgi.conf;
        }
    }

最后执行
/usr/local/nginx/sbin/nginx -s reload

就完事儿了
原创粉丝点击