部署web架構(LAMP)和部署論壇
阿新 • • 發佈:2018-12-13
一.部署web架構(LAMP)
linux + apache + mariadb + php =LAMP =web架構
linux + nginx + mariadb +php/perl/python =lnmp 架構
1.在/var/www/cgi-bin下寫指令碼webapp.wsgi
2.給對指令碼webapp.wsgi執行的許可權
chmod +x webapp.wsgi
3.安裝mod_wsgi.x86_64,並重啟httpd服務
yum search wsgi yum install mod_wsgi.x86_64 -y systemctl restart httpd
4.子配置檔案
cd /etc/httpd/conf.d
vim webapp.conf
<VirtualHost *:80>
ServerName webapp.westos.com
DocumentRoot /var/www/cgi-bin
CustomLog logs/webapp.log combined
WSGIScriptAlias / /var/www/cgi-bin/webapp.wsgi
</VirtualHost>
systemctl restart httpd
測試:客戶端新增本地解析
vim /etc/hosts
二.部署論壇
1.針對論壇配置apache
vim /etc/httpd/conf.d/bbs.conf <VirtualHost *:80> ServerName bbs.westos.com DocumentRoot /var/www/westos.com/bbs/html CustomLog logs/bbs.log combined </VirtualHost> <Directory "/var/www/westos.com/bbs/html"> Require all granted </Directory> mkdir /var/www/westos.com/bbs/html -p
2.下載論壇php程式碼並解壓到/var/www/westos.com/bbs/html
cd /var/www/westos.com/bbs/html
unzip Discuz_X3.2_SC_UTF8.zip
rm -fr Discuz_X3.2_SC_UTF8.zip
3.檢視安裝說明指導
cd readme/
less readme.txt
4.按照readme.txt安裝說明指導修改許可權
cd upload/
chmod -R 777 config
chmod -R 777 data
chmod 777 uc_server uc_client -R
systemctl restart httpd.service
5.設定selinux為警告模式
6.安裝資料庫並安全初始化(詳情見部落格:Linux系統中對資料庫使用和管理)
yum install mariadb-server -y
vim /etc/my.cnf
10 skip-networking=1
systemctl restart mariadb
netstat -atnlupe | grep mysql
mysql_secure_installation
7.安裝資料庫php外掛,以便資料庫能夠被php語言所操作
yum search php
yum install php-mysql.x86_64
systemctl restart httpd.service
測試:
在客戶端新增本地解析 vim /etc/hosts
瀏覽器輸入:bbs.westos.com/upload進行安裝