首先,指定虛擬機器主機時就直接指到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 uri uri uri/ /index.php?s=uri&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/