apache:一个ip绑定多个域名的问题
2012-03-20 20:46
399 查看
基于IP的虚拟主机使用连接的IP地址来决定相应的虚拟主机。这样,你就需要为每个虚拟主机分配一个独立的IP地址。
而基于域名的虚拟主机是根据客户端提交的HTTP头中标识主机名的部分决定的。使用这种技术,很多虚拟主机可以共享同一个IP地址
基于IP的虚拟主机,通过端口区分:
1、httpd.conf启动虚拟主机的配置
2、配置httpd-vhosts添加虚拟主机监听端口为80
添加另一个虚拟主机,假设监听81端口
3、在httpd-vhosts(建议)注销默认的DocumentRoot
4、在htttpd.conf让apache监听其他端口如81
5、在hosts文件添加多对ip和域名的对应关系
C:/window/system32/drivers/etc/hosts
6、重启apache
基于域名的虚拟主机,通过ServerName区分域名
1、httpd.conf启动虚拟主机的配置
2、配置httpd-vhosts
3、在hosts文件添加多对ip和域名的对应关系
4、重启apache
详情可以查看我的另外一篇:/article/7066871.html
而基于域名的虚拟主机是根据客户端提交的HTTP头中标识主机名的部分决定的。使用这种技术,很多虚拟主机可以共享同一个IP地址
基于IP的虚拟主机,通过端口区分:
1、httpd.conf启动虚拟主机的配置
2、配置httpd-vhosts添加虚拟主机监听端口为80
<VirtualHost 127.0.0.1:80> DocumentRoot "" #第一个网站的根目录 DirectoryIndex index.html index.php <Directory> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost >
添加另一个虚拟主机,假设监听81端口
<VirtualHost 127.0.0.1:81> DocumentRoot "" #第二个网站的根目录 DirectoryIndex index.html index.php <Directory> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost >
3、在httpd-vhosts(建议)注销默认的DocumentRoot
4、在htttpd.conf让apache监听其他端口如81
5、在hosts文件添加多对ip和域名的对应关系
C:/window/system32/drivers/etc/hosts
6、重启apache
基于域名的虚拟主机,通过ServerName区分域名
1、httpd.conf启动虚拟主机的配置
2、配置httpd-vhosts
<VirtualHost *:80> DocumentRoot "" #网站的根目录 ServerName www.xxxxxx.com #修改此处 DirectoryIndex index.html index.php <Directory> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost >
3、在hosts文件添加多对ip和域名的对应关系
4、重启apache
详情可以查看我的另外一篇:/article/7066871.html
相关文章推荐
- apache:一个ip绑定多个域名的问题(续)
- Apache windows 配置一个 IP 绑定多个域名
- Apache 同一个IP:端口,绑定多个域名的注意事项
- apache服务器一个ip(如:127.0.0.1)和多个域名(虚拟主机)的绑定
- apache虚拟主机的配置,一个IP绑定多个域名
- apache服务器上绑定ip域名的方法
- Tomcat配置一个ip绑定多个域名
- linux下用Apache一个IP多个网站多域名配置方法
- win2003 多域名绑定一个ip
- PHP开发Apache一个ip对应多个域名
- 在同一个服务器(同一个IP)为不同域名绑定的免费SSL证书
- linux下用Apache一个IP多个网站多域名配置方法
- apache下单ip绑定多域名笔记
- win2003 多域名绑定一个ip
- CentOS + Apache2.2 一个ip配置多个域名
- apache部署多个网站,一个ip部署多域名
- 域名反向查询 DNS反向查询 IP反向查询域名 一个IP上所绑定的域名 虚拟主机绑域名个数查询
- Tomcat 下配置一个ip绑定多个域名
- PHP实现一个ip(如:127.0.0.1)和多个域名(虚拟主机)的绑定
- apache rewrite重定向规则,rewrite正则,二级域名指向一级域名,多域名指向一个域名,IP转向域名