四 Centos 7 部署tp5 api接口 (简单跑起来)
前面的基本配置准备完毕
本次操作是第二次操作的记录,两周前操作部署了一次,此时 初始化服务器后 在来一次操作的记录!
usr/share/nginx/html/ 作为默认的文件部署路径,第一次部署的时候 ,想要换路径!导致出现各种问题。比如404 最后403 又是修改文件的权限 又是修改 用户组等好多折腾!最终成功打开tp5的程序!!
这一次,不强求更换其他的目录 ,只是简单的加了个配置文件 就跑起来程序了...........??
操作记录:
1.新建 tp8002.conf文件,内容
server {
listen 8002;
root /usr/share/nginx/html/tp5/public;
# Load configuration files for the default server block.
location / {
index index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
location ~ .php$ {
try_files $uri =404;
root /usr/share/nginx/html/tp5/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
}
2.上传放在 /etc/nginx/conf.d 下
3.usr/share/nginx/html 下上传tp5整个程序
4.浏览器访问 ip:8002/ 出现tp5的欢迎页
5.访问 其他的接口 比如 ip:8002/login 就会报错!还需要加一个关于tp5的设置 即上面代码中红色加粗的地方
tp5配置参考 https://www.cnblogs.com/nyfz/p/9390842.html
另外 换个路径 部署
放在 /home下 此时 需要修改/home/tp5的权限

部署前端代码
最简单的配置
server { listen 8004; root /home/wfydoc; # Load configuration files for the default server block. }
未完
nginx配置 与shell linus的基本操作
6666

浙公网安备 33010602011771号