系统相关
首页 > 系统相关> > nginx下TP3.2访问页面总是404

nginx下TP3.2访问页面总是404

作者:互联网

这是我测试onethink用的配置 可以参考一下

 

server {
    listen 80;
    server_name onethink.dev www.onethink.dev;
    
    root /vagrant/www/onethink;
    index index.php;
    
    location / {
        if ( -f $request_filename) {
            break;    
        }

        if ( !-e $request_filename) {
            rewrite ^/(.*)$ /index.php/$1 last;
            break;    
        }
    }    

    location ~ \.php {
        set $script $uri;
        set $path_info "";
        if ($uri ~ "^(.+\.php)(/.+)") {
            set $script $1;
            set $path_info $2;    
        }    

        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$script;
        fastcgi_param SCRIPT_NAME $script;
        try_files $uri =404;
    }
}

 

标签:index,set,onethink,script,nginx,404,TP3.2,php,fastcgi
来源: https://www.cnblogs.com/jasonLiu2018/p/10965936.html