購買阿里雲服務器
centos 64
下載lnmp一鍵安裝包 https://lnmp.org/
上傳到 /home
對解壓包權限賦值. 777
執行 ./install
安裝composer
步驟參照thinkphp5.1開發手冊
然後用composer 按照thinkphp5
綁定虛擬站點
/usr/local/nginx/conf/vhost/
新建一個份 t5.conf文件
server
{
listen 80;
#listen [::]:80 default_server ipv6only=on;
server_name www.t5.cn;
index index.html index.htm index.php;
root /home/wwwroot/t5/public;
#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;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/t5.log;
}
坑來了, 這裏面 root /home/wwwroot/t5/public;
綁定的是pubic 目錄, 如果鎖定這個是根目錄, 那麼上層的application就訪問不到, 鎖定了權限.
這是因爲/usr/local/nginx/conf/vhost/ 下面有一個fastcgi.conf的配置文件,
最後一句, 鎖定只在當前目錄活動了
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
所以這一句前面加上#, 註釋掉就可以用了
編輯完重啓
service nginx restart
service php-fpm restart