yii2使用nginx部署上线时访问非index.php页面显示404错误【遇到的坑】

  • 2019 年 10 月 10 日
  • 筆記

yii2使用nginx部署上线时访问非index.php页面显示404错误【遇到的坑】

如:访问首页(index.php)正常

访问其他页面(非index.php)显示404错误

解决方案:

在nginx配置文件

server {

#加入配置

location / { try_files $uri $uri/ /index.php?$args; }

}

正常显示: