zoukankan      html  css  js  c++  java
  • apche基于域名,ip,端口的配置

    基于域名的服务端:
    13 iptables -F
    14 setenforce 0
    15 ifconfig eth0 172.18.43.146
    16 yum -y install bind bind-chroot
    17 cd /var/named/chroot/
    18 vim /etc/named.conf 
    19 vim /var/named/baidu.com.zone
    编辑:$TTL 86400
    @ IN SOA www.baidu.com. root (
    2014081701
    1H
    1M
    2W
    1D
    )


    @ IN NS www.baidu.com.
    www1.baidu.com. IN A 172.18.43.100
    www2.baidu.com. IN A 172.18.43.102
    20 /etc/init.d/named restart
    21 vim /etc/httpd/conf/httpd.conf 
    22 mkdir /domain1
    23 mkdir /domain2
    24 echo domain1:www1.baidu.com >/domain1/index.html
    25 echo domain2:www2.baidu.com >/domain2/index.html
    26 /etc/init.d/named restart
    27 /etc/init.d/httpd start
    28 /etc/init.d/httpd restart
    客户端访问验证:
    iptables -F
    setenforce 0
    ifconfig eth0 172.18.43.147
    vim /etc/resolv.conf
    www1.baidu.com 
    www2.baidu.com


    基于ip的服务端:
    29 vim /etc/httpd/conf/httpd.conf 
    30 service httpd restart
    31 mkdir /ip1
    32 mkdir /ip2
    33 echo ip1:172.18.43.148 >/ip1/index.html
    34 echo ip2:172.18.43.149 >/ip2/index.html
    35 ifconfig eth0:0 172.18.43.148
    36 ifconfig eth0:0 172.18.43.149
    37 service httpd restart
    客户端访问验证:
    http://172.18.43.148
    http://172.18.43.149


    基于端口服务端:
    38 vim /etc/httpd/conf/httpd.conf 
    39 cd /ip1
    40 cat index.html
    41 ifconfig 
    42 ifconfig eth0:1 172.18.43.148 
    49 vim /etc/httpd/conf/httpd.conf 
    50 service httpd restart
    51 mkdir /port1
    52 mkdir /port2
    53 echo port1:8080 > /port1/index.html
    54 echo port2:8081 > /port2/index.html
    55 service httpd restart
    客户端访问验证:
    172.18.43.146:8080
    172.18.43.146:8081


    apache里面的配置:
    1.基于域名的:
    NameVirtualHost *:80
    <VirtualHost 172.18.43.100:80>
    DocumentRoot /domain1
    ServerName www1.baidu.com
    </VirtualHost>
    <VirtualHost 172.18.43.102:80>
    DocumentRoot /domain2
    ServerName www2.baidu.com
    </VirtualHost>
    2.基于ip的:
    </VirtualHost>
    <VirtualHost 172.18.43.148:80>
    DocumentRoot /ip1
    </VirtualHost>
    <VirtualHost 172.18.43.149:80>
    DocumentRoot /ip2
    </VirtualHost>
    3.基于端口的:
    </VirtualHost>
    Listen 8080
    Listen 8081
    <VirtualHost *:8080>
    DocumentRoot /port1
    ServerName 172.18.43.146:8080
    </VirtualHost>
    <VirtualHost *:8081>
    DocumentRoot /port2
    ServerName 172.18.43.146:8081
    </VirtualHost>

    基于域名的服务端:
    13 iptables -F
    14 setenforce 0
    15 ifconfig eth0 172.18.43.146
    16 yum -y install bind bind-chroot
    17 cd /var/named/chroot/
    18 vim /etc/named.conf 
    19 vim /var/named/baidu.com.zone
    编辑:$TTL 86400
    @ IN SOA www.baidu.com. root (
    2014081701
    1H
    1M
    2W
    1D
    )


    @ IN NS www.baidu.com.
    www1.baidu.com. IN A 172.18.43.100
    www2.baidu.com. IN A 172.18.43.102
    20 /etc/init.d/named restart
    21 vim /etc/httpd/conf/httpd.conf 
    22 mkdir /domain1
    23 mkdir /domain2
    24 echo domain1:www1.baidu.com >/domain1/index.html
    25 echo domain2:www2.baidu.com >/domain2/index.html
    26 /etc/init.d/named restart
    27 /etc/init.d/httpd start
    28 /etc/init.d/httpd restart
    客户端访问验证:
    iptables -F
    setenforce 0
    ifconfig eth0 172.18.43.147
    vim /etc/resolv.conf
    www1.baidu.com 
    www2.baidu.com


    基于ip的服务端:
    29 vim /etc/httpd/conf/httpd.conf 
    30 service httpd restart
    31 mkdir /ip1
    32 mkdir /ip2
    33 echo ip1:172.18.43.148 >/ip1/index.html
    34 echo ip2:172.18.43.149 >/ip2/index.html
    35 ifconfig eth0:0 172.18.43.148
    36 ifconfig eth0:0 172.18.43.149
    37 service httpd restart
    客户端访问验证:
    http://172.18.43.148
    http://172.18.43.149


    基于端口服务端:
    38 vim /etc/httpd/conf/httpd.conf 
    39 cd /ip1
    40 cat index.html
    41 ifconfig 
    42 ifconfig eth0:1 172.18.43.148 
    49 vim /etc/httpd/conf/httpd.conf 
    50 service httpd restart
    51 mkdir /port1
    52 mkdir /port2
    53 echo port1:8080 > /port1/index.html
    54 echo port2:8081 > /port2/index.html
    55 service httpd restart
    客户端访问验证:
    172.18.43.146:8080
    172.18.43.146:8081


    apache里面的配置:
    1.基于域名的:
    NameVirtualHost *:80
    <VirtualHost 172.18.43.100:80>
    DocumentRoot /domain1
    ServerName www1.baidu.com
    </VirtualHost>
    <VirtualHost 172.18.43.102:80>
    DocumentRoot /domain2
    ServerName www2.baidu.com
    </VirtualHost>
    2.基于ip的:
    </VirtualHost>
    <VirtualHost 172.18.43.148:80>
    DocumentRoot /ip1
    </VirtualHost>
    <VirtualHost 172.18.43.149:80>
    DocumentRoot /ip2
    </VirtualHost>
    3.基于端口的:
    </VirtualHost>
    Listen 8080
    Listen 8081
    <VirtualHost *:8080>
    DocumentRoot /port1
    ServerName 172.18.43.146:8080
    </VirtualHost>
    <VirtualHost *:8081>
    DocumentRoot /port2
    ServerName 172.18.43.146:8081
    </VirtualHost>

  • 相关阅读:
    闭区间上的连续函数必定是一致连续的
    利用开区间覆盖的约简给出$\bf{Lindelöf}$覆盖定理的一个新证明
    $\mathbf{R}^n$中的紧集是闭有界集
    $\mathbf{R}^n$中的紧集是闭有界集
    陶哲轩实分析 习题10.2.7 导函数有界的函数一致连续
    $\mathbf{R}$上的离散点集是至多可数集
    利用开区间覆盖的约简给出$\bf{Lindelöf}$覆盖定理的一个新证明
    闭区间上的连续函数必定是一致连续的
    $\mathbf{R}$上的离散点集是至多可数集
    利用开区间覆盖的约简给出有限覆盖定理的一个新证明
  • 原文地址:https://www.cnblogs.com/zhanglong68/p/6409051.html
Copyright © 2011-2022 走看看