日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
linux7下虛擬主機的三種實現(xiàn)方式

一、 相同IP地址,不同端口號

成都創(chuàng)新互聯(lián)公司是一家專業(yè)提供新野企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計制作、網(wǎng)站制作、H5場景定制、小程序制作等業(yè)務(wù)。10年已為新野眾多企業(yè)、政府機構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)絡(luò)公司優(yōu)惠進行中。

虛擬主機1:主機IP地址為172.16.30.20,端口號為80(默認端口),DocumentRoot是/var/www/vhost1,在DocumentRoot目錄下創(chuàng)建虛擬主機站點主頁文件。

[root@rhel7 ~]# cd /var/www/
[root@rhel7 www]# mkdir vhost1
[root@rhel7 www]# cd vhost1/
[root@rhel7 vhost1]# vim index.html
[root@rhel7 vhost1]# cat index.html
this is the vhost1

虛擬主機2:主機IP地址為172.16.30.20,端口號為8080,DocumentRoot是/var/www/vhost2,在DocumentRoot目錄下創(chuàng)建虛擬主機站點主頁文件。

[root@rhel7 ~]# cd /var/www/
[root@rhel7 www]# mkdir vhost2
[root@rhel7 www]# cd vhost2/
[root@rhel7 vhost2]# vim index.html
[root@rhel7 vhost2]#
[root@rhel7 vhost2]# cat index.html
this is the vhost2

編輯虛擬機主機配置文件httpd-vhosts.conf

[root@rhel7 ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf

  DocumentRoot "/var/www/vhost1"

Listen 8080

  DocumentRoot "/var/www/vhost2"

[root@rhel7 ~]# systemctl restart httpd
[root@rhel7 ~]# firewall-cmd --add-port=8080/tcp --permanent
success
[root@rhel7 ~]# firewall-cmd --reload
success

訪問測試:

二、 不同IP地址,相同端口號

虛擬主機1:主機IP地址為172.16.30.20,端口號為80(默認端口),DocumentRoot是/var/www/vhost1,在DocumentRoot目錄下創(chuàng)建虛擬主機站點主頁文件。

虛擬主機2:主機IP地址為172.16.30.200,端口號為80(默認端口),DocumentRoot是/var/www/vhost2,在DocumentRoot目錄下創(chuàng)建虛擬主機站點主頁文件。

[root@rhel7 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=bde41fa3-f559-4de2-ba9a-857fed211aac
DEVICE=ens33
ONBOOT=yes
DNS1=127.0.0.1
ZONE=public
IPADDR=172.16.30.10
PREFIX=24
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPADDR1=172.16.30.100
PREFIX1=24
[root@rhel7 ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf

  DocumentRoot "/var/www/vhost1"



  DocumentRoot "/var/www/vhost2"


[root@rhel7 ~]# systemctl restart httpd

訪問測試:

三、 相同IP地址,相同端口號,不同F(xiàn)QDN

虛擬主機1:主機IP地址為172.16.30.20,端口號為80(默認端口),F(xiàn)QDN為vhost1.example.com,DocumentRoot是/var/www/vhost1,在DocumentRoot目錄下創(chuàng)建虛擬主機站點主頁文件。

虛擬主機2:主機IP地址為172.16.30.20,端口號為80(默認端口),F(xiàn)QDN為vhost2.example.com,DocumentRoot/var/www/vhost2,在DocumentRoot目錄下創(chuàng)建虛擬主機站點主頁文件。

[root@rhel7 ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf

  DocumentRoot "/var/www/vhost1"
  ServerName vhost1.example.com


  DocumentRoot "/var/www/vhost2"
  ServerName vhost2.example.com

注意:DNS服務(wù)器中需要添加對應(yīng)的解析內(nèi)容。

訪問測試:

記得每次修改完配置文件后需要重啟服務(wù)。

本篇文章到此結(jié)束,如果您有相關(guān)技術(shù)方面疑問可以聯(lián)系我們技術(shù)人員遠程解決,感謝大家支持本站!

創(chuàng)新互聯(lián)【028-86922220】值得信賴的成都網(wǎng)站建設(shè)公司。多年持續(xù)為眾多企業(yè)提供成都網(wǎng)站建設(shè),成都品牌網(wǎng)站設(shè)計,成都高端網(wǎng)站制作開發(fā),SEO優(yōu)化排名推廣服務(wù),全網(wǎng)營銷讓企業(yè)網(wǎng)站產(chǎn)生價值。


本文標(biāo)題:linux7下虛擬主機的三種實現(xiàn)方式
網(wǎng)站鏈接:http://m.5511xx.com/article/cossped.html