覽器訪問svr1的文件--
(將yum倉庫指向ip地址,讓其他服務器通過IP來訪問yum倉庫)
[root@localhost /]# yum -y install httpd
【安裝httpd服務】
[root@localhost /]# systemctl restart httpd
【開啓httpd服務】
[root@localhost /]# mkdir -p var/www/html/cos7dvd
【創建一個目錄】
[root@localhost /]# vim etc/fstab
dve/cdeom /var/www/html/cos7dvd iso9660 defaults 0 0
【編輯etc下面的fstab 相當於cos7dvd掛載到dvd上】
[root@localhost /]# mount -a
(如果之間掛載過用 umount ///以前掛載的文件路徑進行清除)
【激活掛載】
[root@localhost /]# rm -rf etc/yum.repos.d/.repo
【刪除etc下面的 .repo文件,清除可能有干擾的軟件源配置】
[root@localhost /]# vim etc/yum.conf
gpgcheck=0
【進入yum.conf修改gpgcheck爲0 不檢查軟件包的簽名】
[root@localhost /]# yum-config-manager -add http://192.168.10.110/cos7dvd
【將yum倉庫指向ip地址的cos7dvd】
[root@localhost /]# yum clean all
【清空緩存的軟件源信息】
[root@localhost /]# yum repolist
【檢查軟件源列表】
靜態:提供的文檔資源是固定不變的,從瀏覽器訪問時只讀
*.html .jpg .png .txt .zip
動態:提供的文檔資源是變化的,從瀏覽器訪問時實現交互功能
使用交互功能的網頁程序比如:.php .wsgi .jsp .asp
大多數情況會用到數據庫
搭建LAMP動態網站服務器並確保護能可用的
LAMP:一種成熟的動態企業網站服務器的模式
1--裝包
[root@localhost /]# yum -y install httpd mariadb-server php php-mysql
【安裝 httpd ,mariadb服務器,php php-mysql數據庫】
2--配置【默認配置】
3--起服務
[root@localhost /]# systemctl restart httpd mariadb
[root@localhost /]# systemctl enable httpd mariadb
【啓用服務】
測試LAMP動態網站服務器
1 確保支持PHP網頁
[root@localhost /]# vim var/www/html/123.php
<?php
phpinfo()
?>
【進入後編輯網頁】
2確保PHP網頁能成功訪問數據庫
[root@localhost /]# vim var/www/html/1234.php
<?php
$link=mysql_connect('localhost','root','');
if($link) echo "Success !!"; //成功則顯示 Success !!
else echo "Failure !!"; //失敗則顯示 Failure !!
mysql_close(); //關閉數據庫連接
?>
【進入新的php進行編寫】
爲mariadb數據庫服務設置管理密碼:
[root@localhost /]# mysqladmin -uroot password '123456'
【設置密碼123456】
[root@localhost /]# vim var/www/html/1234.php
$link=mysql_connect('localhost','root','123456');
【進入1234.php把密碼添加進去,如果不添加結匯顯示Failure】
[root@localhost /]# mysqladmin -uroot -p舊密碼 password '123456'
【更改密碼】
爲多個域名臨時提供解析
1 添加本地解析記錄
[root@localhost /]# vim etc/hosts
192.168.10.110 tts8.tedu.cn ne.tedu.cn bbs.tedu.cn
【進入hosts 將多個域名指向一個IP地址】
2 檢查配置結果
ping tts8.tedu.cn ping通即可
實現多個域名分別準備訪問不同的網頁
1 爲不同的域名準備不同的網頁
[root@localhost /]# mkdir var/www/tts8
[root@localhost /]# mkdir var/www/ne
[root@localhost /]# vim var/www/ne/index.html
[root@localhost /]# vim var/www/tts8/index.html
【創建兩個網頁並編輯】
2 告知httpd服務,不同域名的網頁目錄在哪
[root@localhost /]# vim etc/httpd/conf.d/vhosts.conf
<VirtualHost :80>
ServerName tts8.tedu.cn
DocumentRoot /var/www/tts8
</VirtualHost>
<VirtualHost :80>
ServerName ne.tedu.cn
DocumentRoot /var/www/ne
</VirtualHost>
【進入以*.conf格式進行編輯】
部署第三個虛擬的網站(論壇系統)
1 準備論壇網頁
通過winSCP把壓縮包複製到Linux/root下面
[root@localhost ~]# unzip /root/Discuz_X3.4_SC_UTF8.zip
【解壓文件】
[root@localhost ~]# cp -rf upload /var/www/bbs
【 解壓爲upload的文件複製到var下的tts】
[root@localhost /]# vim etc/httpd/conf.d/vhosts.conf
<VirtualHost :80>
ServerName tts.tedu.cn
DocumentRoot /var/www/tts
</VirtualHost>
【進入以.conf文件 進行編輯】
[root@localhost /]# systemctl restart httpd
【重新啓用httpd】
2 訪問網頁http://bbs.tedu.cn。完成論壇安裝
[root@localhost /]# chown -R apache config/ data/ uc_server/ uc_client
【更發所屬用戶apache 默認權限wrx w=讀r=寫執行】
論壇系統的管理和使用
1 訪問論壇系統的後臺頁面(面向管理員)
剛進去會讓你刪除install/index.php,不然以後會重新安裝
[root@localhost /]# rm -rf /var/www/bbs/install/index.php
F5刷新 就沒有了
更改LOGO
點擊圖片然後點擊複製圖片地址
http://bbs.tedu.cn/static/image/common/logo.png
推理出圖片所在位置
然後將自己做好的LOGO 通過winscp 傳到相對的路徑中
注:圖片名字必須與之前相同,直接複製即可