首页 > 代码库 > web网站服务基于ip,端口,域名

web网站服务基于ip,端口,域名

基于ip

yum install httpd -y

service httpd start

chkconfig httpd on

vi /etc/httpd/conf/httpd.conf

# Document

<VirtualHost 192.168.100.100:80>

     ServerName www.benet.com

DocumentRoot /www/benet.com

</VirtualHost>


<VirtualHost 192.168.100.110:80>

     ServerName www.accp.com

DocumentRoot /www/accp.com

</VirtualHost>

mkdir -pv /www/{benet.com,accp.com}

cd /www/benet.com/

vi index.html

<title>benet</title>

<h1>www.benet.com</h1>

cd ..

cd accp.com/

vi index.html

<title>accp</title>

<h1>www.accp.com</h1>

service httpd restart

ip address add 192.168.100.100/24 dev eth0

ip address add 192.168.100.110/24 dev eth0

ip addr show



基于端口

vi /etc/httpd/conf/httpd.conf

<VirtualHost 192.168.100.100:80>

     ServerName www.benet.com

DocumentRoot /www/benet.com

</VirtualHost>


<VirtualHost 192.168.100.110:8080>

     ServerName www.huawei.com

DocumentRoot /www/huawei.com

</VirtualHost>


<VirtualHost 192.168.100.100:80>

     ServerName www.benet.com

DocumentRoot /www/benet.com

</VirtualHost>


cd /www/

mkdir huawei.com

cd huawei.com/

vi index.html

<title>huawei</title>

<h1>www.huawei.com</title>

service httpd restart



vi /etc/httpd/conf/httpd.conf

#Listen 12.34.56.78:80

Listen 80

Listen 8080

service httpd restart


基于域名

view/etc/httpd/conf.d/virtual.conf

nameVirtualHost 192.168.100.110:80

<VirtualHost 192.168.100.110:80>

    ServerName blog.csdn.net

DocumentRoot /www/csdn.net

</VirtualHost>

mkdir -p /www/csdn.net/

cd /www/csdn.net/

vi index.html

<title>csdn</title>

<h1>blog.csdn.com</h1>

service httpd restart

win7 windows/systrm32/drivers/etc/hosts

192.168.100.110 www.accp.com

192.168.100.110 blogs.csdn.net

 


技术分享

技术分享













































web网站服务基于ip,端口,域名