首先,指定虚拟主机时就直接指到public下面, 因为入口文件被调整到public下面的index.php,之后访问 你的域名就可以显示成功页面 不然你要 域名/public才可以看到成功页面
如出现如下问题
thinkphp 5.0 lnmp环境下 Warning: require(): open_basedir restriction in effect. File 报错处理
所以nginx的vhost配置文件得做如下修改:
[root@localhost lnmp1.4]# vim /usr/local/nginx/conf/vhost/xxx.abczn.com.conf
server
{
listen 80;
listen [::]:80;
server_name xxx.abczn.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/xxx.abczn.com/public;
include other.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-pathinfo.conf;
location ~ /
{
try_files uriuri/ /index.php?s=uri&args;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /.
{
deny all;
}
error_log /home/wwwlogs/xxx.abczn.com.error.log;
access_log off;
}
以及如下修改php.ini:
你可以用find / -name php.ini找到,添加下面那一段
[HOST= 你的网址]
open_basedir = 你项目的目录:/tmp/:/proc/
[PATH= 你项目的目录]
open_basedir=你项目的目录:/tmp/:/proc/