我本地是window系統,用的是phpstudy,解決辦法:用phpstudy點擊其他選項菜單->打開配置文件->選擇vhost-ini(或者找到nginx安裝目錄,打開vhost.conf),在你的站點配置里
location / {
index index.html index.htm index.php;
#autoindex on;
}
改為
location / {
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$query_string;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
#autoindex on;
}
最后重啟nginx,就搞定了。