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站點的相對路徑;indexindex.php
index.html
index.htm;#charsetkoi8-r;#access_log/var/log/nginx/host.access.log
main;#Loadconfigurationfilesforthedefaultserverblock.include
/etc/nginx/default.d/*.conf;location
/{#try_files$uri$uri//index.php;root/opt/www/pcweb/ytyy_pc;indexindex.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修改文件權限