部署thinkphp的时候无法解析,始终显示404

问答中心分类: PHP部署thinkphp的时候无法解析,始终显示404
匿名用户 asked 9 年 ago

2 Answers
oneinstack answered 9 年 ago
thinkphp需要支持pathinfo,更改下虚拟主机配置文件/usr/local/nginx/conf/vhost/www.xxx.com.conf(下面是一个样例):

server {
listen 443 ssl spdy;
ssl_certificate 1_ss.linuxeye.com_bundle.crt;
ssl_certificate_key ss.linuxeye.com.key;
ssl_ciphers "CHACHA20:GCM:HIGH:!DH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS";
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
server_name ss.linuxeye.com;
access_log off;
index index.html index.htm index.jsp index.php;
root /home/wwwroot/ss.linuxeye.com;

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

location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        try_files $fastcgi_script_name =404;
        set $path_info $fastcgi_path_info;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_pass unix:/dev/shm/php-cgi.sock;
        fastcgi_index index.php;
        include fastcgi.conf;
        }

location ~ /\.ht {
        deny  all;
        }

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
        expires 30d;
        }

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

oneinstack answered 9 年 ago