呐,苦于没法在生产环境使用apache,呐呐呐,虚拟机!
方法一:基于IP
IP1:80
IP2:80
方法二:基于端口
IP:80
IP:8080
方法三:基于域名
IP:80
主机名不同
一、基于IP
1、配置第二地址
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[
root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-eth0:0
[root@localhost network-scripts]# service network restart

2、配置http.conf,添加下面一行
# Virtual hosts
Include /etc/httpd/extra/httpd-vhosts.conf
3、配置httpd-vhosts.conf

4、建立网页目录a.org及zjj

5、新建网页文件

6、用elinks打开网页
[root@localhost htdocs]# elinks

[root@localhost htdocs]# elinks

二、基于端口(注意:iptables放行8080端口)
1、修改httpd.conf
2、
修改httpd-vhosts.conf

3、新建网页目录及网页文件

4、测试
[root@localhost htdocs]# elinks
[root@localhost htdocs]# elinks :8080
三、基于域名
看到空白的,肯定要嫌我懒了。。基于域名基本与前面一直,只要修改hosts文件,能让域名解析到即可。
阅读(12360) | 评论(0) | 转发(0) |