項目本地開發告一段落。准備上傳到服務器上測試
技術組成 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修改文件權限
。
。
。
。
。
。
。
終於搞定了。可以訪問頁面了。