如何部署thinkphp网站thinkphp怎么部署

如题所述

thinkphp5如何部署网站

在WEB根目录下创建一个app子目录(这是app和项目名称),然后在这个目录下创建一个index.php文件,添加一行简单的代码:

/ThinkPHP框架目录/ThinkPHP.PHP;这行代码的作用是加载ThinkPHP框架的入口文件ThinkPHP.php,这是所有基于ThinkPHP的应用的第一步。然后,在浏览器中访问这个门户文件。

php项目如何部署?

一、阿里ECS服务器配置1.因为线上已经有几个站点了.所以要配置ngnix多站点2.阿里云ecs目录结构,ngxin在/etc/nginx/目录下,配置的地方主要是

nginx.config

文件。或者在

conf.d

新建一个配置文件然后在include到

nginx.config

文件中

3.nginx.config

新建站点信息server{listen80;server_namewww.你的域名.com;root站点的相对路径;index

index.php

index.html

index.htm;#charsetkoi8-r;#access_log/var/log/nginx/

host.access.log

main;#Loadconfigurationfilesforthedefaultserver

block.include

/etc/nginx/

default.d/*.conf;location

/{#try_files$uri$uri//index.php;root/opt/www/pcweb/ytyy_pc;index

index.php

index.html

index.htm;if(!-e$request_filename){rewrite^(.*)$/index.php?s=$1last;break;}}url重写(可以没有)#redirectservererrorpagestothestaticpage/40x.html#error_page404/404.html;40错误页面配置location=/

40x.html

{}#redirectservererrorpagestothestaticpage/50x.html#error_page500502503504/50x.html;50错误页面配置location=/

50x.html

{}location~.php${root站点相对路径;fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;includefastcgi_params;}location~/

.ht

{denyall;}}配置文件的基本内容如上;配置完成后测试配置文件是否正确这样配置就可以使用了然后重启nginx服务器这样nginx配置就结束了可以使用了。吧站点文件放到对应的目录下面。我直接gitclone过去的。二

.thinkphp

项目文件转移本来以为上传完就结束了。上传上去碰到的第一个问题就是访问页面报错,页面被电信的114页面劫持了。。。麻蛋看不到报错万能百度大法解决方法

1.internet

高级选项->隐私->站点新加阻止站点解决方法2:控制面板->网络和internet->本地连接->属性->ipv4使用如下ip终于搞定可以看到报错页面了。。。。。。麻蛋。再次开启万能百度大法得到最终结论是文件目录权限引起的。thinkphp的runtime目录没有写入权限。。thinkphp文件上传到阿里的好像都有这个问题。解决问题很简单进入到项目文件目录直接跟文件最高权限chmod-R777//linux修改文件权限

温馨提示:答案为网友推荐,仅供参考
相似回答