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>
~
~
~
~
apche基于域名,ip,端口的配置的更多相关文章
- Apache基于域名、端口、IP的虚拟主机配置(Centos 6.5)
虚拟主机:部署多个站点,每个站点,希望用不同的域名和站点目录,或者是不同的端口,不同的ip,需要虚拟主机功能.一句话,一个http服务要配置多个站点,就需要虚拟主机. 虚拟主机分类:基于域名.基于端口 ...
- Nginx--服务部署、基于域名的虚拟主机配置
一.服务部署 1.预处理 安装CentOS ,配置hosts.静态IP.设置必要的安全参数等(略) 1-1.系统环境 [root@vnx ~]# cat /etc/redhat-release Cen ...
- CentOS 7运维管理笔记(8)----Apache基于域名的虚拟主机配置
使用基于域名的虚拟主机配置是比较流行的方式,可以在同一个IP上配置多个域名并且都通过80端口访问. (1) 在网卡 eth0的第五个接口上配置 192.168.1.215 这个地址: (2) 配置/e ...
- Nginx总结(四)基于域名的虚拟主机配置
前面讲了如何安装配置Nginx,大家可以去这里看看nginx系列文章:https://www.cnblogs.com/zhangweizhong/category/1529997.html 今天要说的 ...
- nginx配置基于域名、端口、IP的虚拟主机
1.基于域名的虚拟主机: 绝大多数企业对外提供服务的网站使用的都是基于域名的主机,通过不同的域名区分不同的虚拟主机. 首先我们进入安装nginxd的目录下:/application/nginx-1.6 ...
- nginx基于域名的虚拟主机配置(本地分布式项目域名配置及测试方法)
最有用的虚拟主机配置方式. 一个域名只能绑定一个ip地址,一个ip地址可以被多个域名绑定. 可以修改host文件实现域名访问. 前提:即使我们在nginx中配置基于域名的虚拟主机,也需要域名解析,即n ...
- Tomcat-8.5.23 基于域名和端口的虚拟主机
下载tomcat yum install java -y cd /opt/ wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.23/b ...
- 【原创】Linux基础之测试域名IP端口连通性
一 测试域名是否可达 1 ping # ping www.baidu.comPING www.a.shifen.com (220.181.112.244) 56(84) bytes of data.6 ...
- apache2 httpd 基于域名的虚拟主机配置 for centos6X 和debian-8
全系统虚拟主机: for debian 系统的apache2 域名 虚拟主机
随机推荐
- Sping--Id, Name
bean, id/name 都可以 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=& ...
- IOS9提示“不受信任的开发者”如何处理
iPhone升级到IOS9版本后,发现部分APP在下载后首次运行时,都会提示“不受信任的应用程序开发者”,这是因为企业证书发布的APP,没有经过AppStore审核,于是iOS对用户做出一个安全性的提 ...
- Learning How to Learn, Part 1
Jan 8, 2015 • vancexu Learning How to Learn: Powerful mental tools to help you master tough subjects ...
- iOS开发中在UIWebView中添加Gif动态图
开发是一件很有趣的事,偶尔在程序中添加一些小东西,会给你的应用增色不少.比如,当你的某些功能暂时还不准备上线时,可以先一个放展示Gif动态图的UIWebView上去,既可以告诉用户APP以后会有的功能 ...
- IOS开发-ObjC-NSDictionary
OC中Foundation框架中有字典类,字典分不可变字典(NSDictionary)和可变字典(NSMutableDictionary),它们的使用如下: 不可变字典: //------------ ...
- FlexGrid简单demo
1.首先加入以下代码 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <hea ...
- OpenCV点滴2
明天回家了-- 昨天去见了老师,去之前告诉自己不要紧张,去了后还是紧张了,语无伦次,很没礼貌--(不敢看老师的眼睛) 刚才妈打电话说让我早点回去,不知道为什么,在空荡荡的宿舍里听到妈的声音,眼泪会夺眶 ...
- 直播流怎么存储在Ceph对象存储上? Linux内存文件系统tmpfs(/dev/shm) 的应用
一./dev/shm理论 默认的Linux发行版中的内核配置都会开启tmpfs,映射到了/dev/下的shm目录.可以通过df 命令查看结果./dev/shm/是linux下一个非常有用的目录,因为这 ...
- ubuntu 安装chrome浏览器
对于一个一直用chrome的人来说,真的很不习惯用firefox,虽然firebug很好用.. 好吧,心情不佳,直接上命令: 下载命令(有墙,下不下来,多试几次): wget https://dl.g ...
- 使用jquery时一些小技巧的总结
使用 each 遍历 var nodes = Ztree.getCheckedNodes(true); //获取所有勾选的节点 $.each(nodes,function(i,value){ aler ...