步骤写的很详细,所有小白遇到的坑我都遇到了,所以把整个整理下来供大家使用
1.首先购买百度云bch,具体的购买步骤和地址就不再赘述了
2.搞定之后,删除webroot目录下的index.php文件
3.通过Composer将tp5.1的代码下载到本地
4.通过Ftp将代码上传到空间内(webroot)目录底下
此时你会非常的疑惑,public目录如何绑定?
别急,接着往下看:
创建bcloud_nginx_user.conf文件
将代码复制进去,即可实现nginx下的tp安装,这是所有繁杂的教程中较为简单实用的一种。喜欢的点一个关注吧。
location/ {
root/home/bae/app/public;
if(-e $document_root/index.php) {
rewrite^/(.*)$ /index.php/$1?$query_string last;
}
return404;
}
## php配置
location~ [^/]\.php(/|$){
root/home/bae/app/public;
fastcgi_indexindex.php;
fastcgi_pass127.0.0.1:9000;
fastcgi_intercept_errorson;
fastcgi_split_path_info^(.+\.php)(.*)$;
fastcgi_paramPATH_INFO $fastcgi_path_info;
fastcgi_paramPATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_paramQUERY_STRING $query_string;
fastcgi_paramREQUEST_METHOD $request_method;
fastcgi_paramCONTENT_TYPE $content_type;
fastcgi_paramCONTENT_LENGTH $content_length;
fastcgi_paramSCRIPT_NAME $fastcgi_script_name;
fastcgi_paramREQUEST_URI $request_uri;
fastcgi_paramDOCUMENT_URI $document_uri;
fastcgi_paramDOCUMENT_ROOT $document_root;
fastcgi_paramSERVER_PROTOCOL $server_protocol;
fastcgi_paramREQUEST_SCHEME $scheme;
fastcgi_paramHTTPS $https if_not_empty;
fastcgi_paramGATEWAY_INTERFACE CGI/1.1;
fastcgi_paramSERVER_SOFTWARE nginx/$nginx_version;
fastcgi_paramREMOTE_ADDR $remote_addr;
fastcgi_paramREMOTE_PORT $remote_port;
fastcgi_paramSERVER_ADDR $server_addr;
fastcgi_paramSERVER_PORT $server_port;
fastcgi_paramSERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_paramREDIRECT_STATUS 200;
}
location~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
root/home/bae/app/public;
expires30d;
access_logoff;
}
location~ .*\.(js|css)?$ {
root/home/bae/app/public;
expires7d;
access_logoff;
}
location~ /\.ht {
root/home/bae/app/public;
denyall;
}
## 禁止敏感文件的直接访问
location~* \.(inc|bak|sql|lua|so|ini|conf)$ {
denyall;
}