修改服务器配置:nginx.conf
server {
charset utf-8;
client_max_body_size 128M;
listen 80;
server_name local.yii2test.com
index index.php index.html index.htm;
root /usr/local/nginx/html/yii2test/web;
location ~ \.php$ {
root /usr/local/nginx/html/yii2test/web;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
#yii框架使用代码
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php?$args;
}
location ~ /\.ht {
deny all;
}
}