购买阿里云服务器
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