此问题困扰了我好几天,今天终于重坑里面爬出来了,留下笔记,希望对大家有帮助!
环境:Nginx1.12.1 PHP5.6 Coentos7.2
修改网站配置文件
例如 /usr/local/nginx/conf/vhost/test.bb.com
server
{
listen 80;
#listen [::]:80;
server_name test.bb.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/test.bb.com/public;
include none.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
#include enable-php.conf;
#将url中server_name之后的部分与 /tp5/public/* 匹配 如果匹配则改写URl为/tp5/public/index.php/*
#lnmp一键安装包可直接 include thinkphp.conf