Linux運維基礎(chǔ)httpd靜態(tài)網(wǎng)頁教程
1.利用倉庫創(chuàng)建httpd lrzsz unzip文件
1.掛載 [root@clq0917 ~]# mount /dev/cdrom /mnt/ mount: /dev/sr0 寫保護(hù),將以只讀方式掛載 寫配置文件 [root@clq0917 ~]# vi /etc/yum.repos.d/aa.repo [aa] name=sssaaa baseurl=file:///mnt gpgcheck=0 enabled=1 按下ESC鍵,輸入:x保存 清理倉庫 [root@clq0917 ~]# yum clean all 元數(shù)據(jù)建立 [root@clq0917 ~]# yum makecache 2.安裝 [root@clq0917 ~]# yum -y install httpd [root@clq0917 ~]# yum -y install lrzsz [root@clq0917 ~]# yum -y install httpd [root@clq0917 ~]# yum -y install unzip
2.對源碼文件進(jìn)行解壓
[root@clq0917 ~]# cd /var/www/html 加文件[root@clq0917 html]# rz 解壓[root@clq0917 html]# unzip wangzhang.zip mv (解碼數(shù)據(jù))+名字(wangzhang) [root@clq0917 html]# unzip zhishaizi.zip mv (解碼數(shù)據(jù))+名字(zhishaizi) [root@clq0917 html]# unzip zhuawawa.zip mv (解碼數(shù)據(jù))+名字(zhuawawa) 刪掉不用的 [root@clq0917 html]# rm -rf zhuawawa.zip [root@clq0917 html]# rm -rf wangzhang.zip [root@clq0917 html]# rm -rf zhishaizi.zip 查看: [root@clq0917 html]# ls wangzhang zhishaizi zhuawawa
3.配置httpd-vhosts.conf的3種方法
1.[root@clq0917 html]# vi httpd-vhosts.conf Listen 98 <VirtualHost *:98> DocumentRoot "/var/www/html/wangzhang" ServerName wz.example.com </VirtualHost> Listen 99 <VirtualHost *:99> DocumentRoot "/var/www/html/zhuawawa" ServerName zww.example.com </VirtualHost> Listen 100 lHost *:100> DocumentRoot "/var/www/html/zhishaizi" ServerName zsz.example.com </VirtualHost> 刷新一下: [root@clq0917 html]# systemctl restart httpd [root@qn conf.d]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 *:98 *:* LISTEN 0 128 *:99 *:* LISTEN 0 128 *:100 *:* LISTEN 0 128 [::]:22 [::]:* 看到98 99 和100端口號就表示成功了。
方法1:(相同IP,不同端口號配置)
1.[root@clq0917 html]# vi httpd-vhosts.conf Listen 98 <VirtualHost *:98> DocumentRoot "/var/www/html/wangzhang" ServerName wz.example.com </VirtualHost> Listen 99 <VirtualHost *:99> DocumentRoot "/var/www/html/zhuawawa" ServerName zww.example.com </VirtualHost> Listen 100 lHost *:100> DocumentRoot "/var/www/html/zhishaizi" ServerName zsz.example.com </VirtualHost> 刷新一下: [root@clq0917 html]# systemctl restart httpd [root@qn conf.d]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 *:98 *:* LISTEN 0 128 *:99 *:* LISTEN 0 128 *:100 *:* LISTEN 0 128 [::]:22 [::]:* 看到98 99 和100端口號就表示成功了。
百度搜索:
192.168.174.131:98
192.168.174.131:99
192.168.174.131:100
效果圖:
方法2:(不同IP,相同端口號配置)
1.配置IP地址 [root@clq0917 html]# ip addr add 192.168.174.175/24 dev ens33 [root@clq0917 html]# ip addr add 192.168.174.176/24 dev ens33 [root@clq0917 html]# vi httpd-vhosts.conf Listen 99 <VirtualHost 192.168.174.131:99> DocumentRoot "/var/www/html/wangzhang" ServerName wz.example.com </VirtualHost> <VirtualHost 192.168.174.175:99> DocumentRoot "/var/www/html/zhuawawa" ServerName zww.example.com </VirtualHost> lHost 192.168.174.176:99> DocumentRoot "/var/www/html/zhishaizi" ServerName zsz.example.com </VirtualHost> 刷新一下: [root@clq0917 html]# systemctl restart httpd [root@qn conf.d]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:99 *:* *:* LISTEN 0 128 [::]:22 [::]:* 看到 99端口號就表示成功了。
百度搜索:
192.168.174.131:99
192.168.174.175:99
192.168.174.176:99
效果圖:
方法3:(相同IP,相同端口號,不同域名)
1.[root@clq0917 html]# vi httpd-vhosts.conf Listen 80 <VirtualHost *:80> DocumentRoot "/var/www/html/wangzhang" ServerName wz.example.com </VirtualHost> <VirtualHost *:80> DocumentRoot "/var/www/html/zhuawawa" ServerName zww.example.com </VirtualHost> lHost *:80> DocumentRoot "/var/www/html/zhishaizi" ServerName zsz.example.com </VirtualHost> 刷新一下: [root@clq0917 html]# systemctl restart httpd [root@qn conf.d]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 *:80 *:* 看到80端口號就表示成功了。 進(jìn)入C盤的C:\Windows\System32\drivers\etc目錄下,把hosts文件拖到桌面上并用寫字板打開,加入以下內(nèi)容并保存 192.168.174.131 wz.example.com zww.example.com zsz.example.com 把桌面上的hosts文件拖回C:\Windows\System32\drivers\etc目錄下,打開CMD,輸入 ping zww.example.com看是否能通 然后在瀏覽器上用域名訪問
hosts:
cmd:
以上就是Linux運維基礎(chǔ)httpd靜態(tài)網(wǎng)頁教程的詳細(xì)內(nèi)容,更多關(guān)于Linux運維httpd靜態(tài)網(wǎng)頁的資料請關(guān)注腳本之家其它相關(guān)文章!感謝閱讀~
相關(guān)文章
阿里云服務(wù)器CentOS 6.3下快速安裝部署 LAMP 、vsftpd 環(huán)境的方法
這篇文章主要介紹了阿里云服務(wù)器CentOS 6.3下快速安裝部署 LAMP 、vsftpd 環(huán)境的方法的相關(guān)資料,需要的朋友可以參考下2016-02-02Linux中使用Crontab定時監(jiān)測維護(hù)Tomcat應(yīng)用程序的方法
定時監(jiān)測發(fā)布的某項應(yīng)用程序是否可用,如果不可用,立即執(zhí)行處理措施,實現(xiàn)自動化運維工作2014-11-11在 Linux 中不使用 CD 命令進(jìn)入目錄/文件夾的方法
眾所周知,如果沒有 cd 命令,我們無法 Linux 中切換目錄。接下來通過本文給大家介紹了在 Linux 中不使用 CD 命令進(jìn)入目錄/文件夾的方法,需要的朋友可以參考下2019-04-04CentOS6.5與CentOS7 ssh修改默認(rèn)端口號的方法
這篇文章主要介紹了CentOS6.5與CentOS7 ssh修改默認(rèn)端口號的方法,結(jié)合實例形式分別描述了CentOS6.5及CentOS7針對ssh修改默認(rèn)端口號的具體操作步驟、相關(guān)命令與使用技巧,需要的朋友可以參考下2018-04-04linux網(wǎng)絡(luò)參數(shù)配置方法詳解
這篇文章主要介紹了linux網(wǎng)絡(luò)參數(shù)的配置方法,這樣可以讓你的服務(wù)器訪問網(wǎng)絡(luò),主要參數(shù):IP地址、子網(wǎng)掩碼、網(wǎng)關(guān)、DNS2013-11-11linux cat more less顯示文件的區(qū)別
liunx下幾個常見的用于顯示文件命令的區(qū)別2008-06-06