欢迎光临
我们一直在努力

【日记】thinkphp项目阿里云ECS服务器部署

项目本地开发告一段落。准备上传到服务器上测试

技术组成 thinkphp+mysql+阿里ECS  代码管理方式git

一、阿里ECS服务器配置

     1.因为线上已经有几个站点了.所以要配置ngnix多站点

     2.阿里云ecs目录结构,ngxin 在/etc/nginx/目录下,配置的地方主要是nginx.config文件。或者在conf.d新建一个配置文件然后在include到nginx.config文件中

        

     3.nginx.config新建站点信息

server { listen 80; server_name www.你的域名.com; root  站点的相对路径; index index.php index.html index.htm; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; # Load configuration files for the default server 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=$1 last; break; }} url重写(可以没有) # redirect server error pages to the static page /40x.html # error_page 404 /404.html; 40错误页面配置 location = /40x.html { } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; 50错误页面配置 location = /50x.html { } location ~ \.php$ { root 站点相对路径; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }

配置文件的基本内容如上;

配置完成后测试配置文件是否正确

这样配置就可以使用了

然后重启nginx服务器 

这样nginx配置就结束了可以使用了。吧站点文件放到对应的目录下面。我直接git clone过去的。

二.thinkphp项目文件转移

本来以为上传完就结束了。上传上去碰到的第一个问题就是访问页面报错,页面被电信的114页面劫持了。。。麻蛋 看不到报错

万能百度大法

解决方法1.internet高级选项->隐私->站点  新加阻止站点

解决方法2:控制面板->网络和internet->本地连接->属性->ipv4  使用如下ip

终于搞定可以看到报错页面了。。。。。。麻蛋。再次开启万能百度大法

 

 

 得到最终结论是文件目录权限引起的。thinkphp 的runtime目录没有写入权限。。thinkphp文件上传到阿里的好像都有这个问题。解决问题很简单

进入到项目文件目录

直接跟文件最高权限

chmod -R 777 [目录] //linux修改文件权限

 

 

 

终于搞定了。可以访问页面了。

 

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:【日记】thinkphp项目阿里云ECS服务器部署
文章链接:https://www.jmwz.net/5536.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址