天天看点

20171107L09-01老男孩Linux运维实战培训-Lamp系列-Apache服务生产实战应用指南04-基于IP的虚拟主机实战配置

加IP

这个属于子端口加IP

命令

ifconfig eth1:88 172.18.0.88 netmark 255.255.255.0 up

这样就加了一个IP在eth1 这个网卡的子端口上

也就是多IP

删除IP

ifconfig eth1:88 down

<VirtualHost *:@@Port@@>

    ServerAdmin [email protected]

    DocumentRoot "@@ServerRoot@@/docs/dummy-host.example.com"

    ServerName dummy-host.example.com

    ServerAlias www.dummy-host.example.com

    ErrorLog "/var/log/httpd/dummy-host.example.com-error_log"

    CustomLog "/var/log/httpd/dummy-host.example.com-access_log" common

</VirtualHost>

<VirtualHost 10.0.0.88:80>            #在前面加IP

ServerName  10.0.0.88                    #换成IP

这就是基于IP的访问

     本文转自wangchangshu2 51CTO博客,原文链接:http://blog.51cto.com/398528/1979688,如需转载请自行联系原作者