tp5在linux下部署的問題(lnmp安裝包的環境)____linux

來源:互聯網
上載者:User

首先,指定虛擬機器主機時就直接指到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/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.