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 域名 虚拟主机
随机推荐
- tinyxml2库的使用--MFC工程
在编写应用程序的时候,经常需要动态加载某些数据,这种情况下微软的ini文件是蛮好的选择,但是平台的通用性比较差,使用xml的话就比较强一点,但是解析比较复杂,型号有牛人已经开发出了直接读写xml的库, ...
- 第一章 Slenium2-Java 自动化测试基础
都是一些最基础的知识点. 一:软件测试分类 1)单元测试:单元测试(或模块测试)是对程序中的单个子程序或具有独立功能的代码段进行测试的过程.2)集成测试:集成测试是在单元测试的基础上,先通过单元模块组 ...
- 安卓能用的modebus CRC16计算,附上对应的C语言的CRC16(转)
源:安卓能用的modebus CRC16计算,附上对应的C语言的CRC16 “源”即是原文地址,想了解作都更多文章及思想请移步到“源”.转过只是为了本人感兴趣的文章查找方便. 正文: 最近写安卓串口通 ...
- @synthesize和@dynamic
@synthesize 除非开发人员已经做了,否则由编译器自动生成getter/setter方法.当开发人员自定义存或取方法时,自定义会屏蔽自动生成该方法. @dynamic 告诉编译器,不自动生成g ...
- Delphi 与 DirectX
关于DirectX 在Delphi下的使用 源:Delphi 与 DirectX
- C语言-表达式
表达式是使用运算符连接起来的式子,C语言中的表达式有以下几种: 1.算数运算符 + - * / % 2.赋值运算符 += -= *= /= %= 3.自增.自减 ++ -- a++为先 ...
- UVa 336 - A Node Too Far
题目大意:在计算机网络中,每条信息都有一个TTL值,在信息到达一个节点时,TTL值首先减1,如果TTL为0,则丢弃该信息报文.给一个网络的配置,给定源点和TTL值,判断该网络中有多少节点不可到达. 无 ...
- linux 下source、sh、bash、./执行脚本的区别
原文地址:http://blog.csdn.net/caesarzou/article/details/7310201 source命令用法: source FileName 作用:在当前bash环境 ...
- java_web学习(15)jQuery
JavaScript 库作用及对比 为了简化 JavaScript 的开发, 一些 JavsScript 库诞生了. JavaScript 库封装了很多预定义的对象和实用函数.能帮助使用者建立有高难度 ...
- Unity 压缩texture
当我们往服务器保存图片时 并不会仅仅保留原图 一般会另外保存一张缩略图 当加载文件夹时只加载缩略图 当在点击缩略图打开图片时 再加载原缩略图 以节省时间和内存 下面以将屏幕截图保存到服务器为例 将屏幕 ...