centos配置lnmp環境詳解及相關問題

來源:互聯網
上載者:User

標籤:

安裝系統,配置環境第一步:進入系統
用工具putty進入centos系統,輸入帳號密碼。
第二步:遠程終端連接埠
screen -S lnmp

如果提示screen: command not found,需要安裝screen

yum install screen
第三步:安裝LNMP環境

安裝過程中可以選擇相應的設定,預設也可以!
1.2版本

wget -c http://soft.vpser.net/lnmp/lnmp1.2-full.tar.gz && tar zxf lnmp1.2-full.tar.gz && cd lnmp1.2-full && ./install.sh lnmp

1.3版

wget -c http://soft.vpser.net/lnmp/lnmp1.3beta-full.tar.gz && tar zxf lnmp1.3beta-full.tar.gz && cd lnmp1.3-full && ./install.sh lnmp
第四步:安裝ZMODEM傳輸檔案

本人感覺特別方便的一個FTP功能,putty目前不能用,可以用免費的xshell
文法: rz (本地檔案發送到伺服器,直接鍵入即可)
sz test.zip (把伺服器的test.zip檔案下載到本地)

yum install -y lrzsz
第五步:安裝zip

文法: unzip test.zip (解壓test.zip到當前檔案夾)
zip -r test test.zip (壓縮test檔案夾)

 yum install -y unzip zip
第六步:搭建vsftpd(FTP環境)

可以參考之前寫的文章,centos7親測 (http://blog.csdn.net/atermerry/article/details/51264153)

FAQ添加/刪除/列出網站
Lnmp vhsot addlnmp vhost dellnmp vhost list
刪除.user.ini

在刪除網站時,lnmp會提示需要刪除.user.ini , 代碼中 /website/www.xxx.com 為你網站的地址,刪除該檔案後,再刪除www.xxx.com

chattr -i /website/www.xxx.com/.user.inirm -rf /website/www.xxx.com
重啟nginx
service nginx restart
設定偽靜態

添加網站時,添加預設的偽靜態,或者不添加
上傳自訂的偽靜態檔案(例如 wjt.conf),cd /usr/local/nginx/conf/ 下面
編輯設定檔,修改include檔案名稱

vi /usr/local/nginx/conf/vhost/網域名稱.conf

301跳轉

開啟該網域名稱的設定檔 ,例如www.xxx.com

vi /usr/local/nginx/conf/vhost/www.xxx.com.conf

保證service_name只有www.xxx.com

在最後邊添加

server        {            listen 80;            server_name xxx.com;            return 301 http://www.xxx.com$request_uri;        }
重設資料庫密碼

進入安裝工具包 , ls 查看一下你裝的是1.2版本還是1.3版本,這裡是1.3版本

cd lnmp1.3-full/tools ./reset_mysql_root_password.sh
解決wget: unable to resolve host address

很蛋疼的問題,這是因為服務沒有妹紙dns地址,就像家裡的路由器或者電腦一樣.

vi /etc/resolv.conf

dns內容可以填寫Google的

nameserver 8.8.8.8nameserver 8.8.4.4
卸載vsftp

查看當前伺服器中的版本

rpm -qa|grep vsftpd rpm -e 那個版本名稱

返回:卸載時自動備份vsftp的使用者列表檔案
warning: /etc/vsftpd/vsftpd.conf saved as /etc/vsftpd/vsftpd.conf.rpmsave
warning: /etc/vsftpd/user_list saved as /etc/vsftpd/user_list.rpmsave
刪除

rm -rf /etc/vsftpd

查看vsftpd是否還在開機啟動項中

chkconfig --list

查看vsftpd運行狀態

service vsftpd status

返回:vsftpd: unrecognized service(無法識別vsftpd,說明卸載了vsftpd了)

網站開啟出現403

1.官方的解釋是沒有配置預設文件, 這個可以在網站的設定檔查看下,
2.另外一個,許可權問題.例如網站的根目錄為website,先解開website許可權:

chattr -i webssite

設定許可權:

chamod -R 755 website

寫死website:

chattr +i website
資料庫遠端連線(phpmyadmin)

進入phpmyadmin建立使用者test , 進入地址為ip地址 (#.#.#.#/phpmyadmin) , 建議安裝後變更檔夾名稱

mysql - u root - puse mysql ;update user set host = ‘%‘ where user = ‘test‘;flush privileges;exit;

centos配置lnmp環境詳解及相關問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.