基于IP地址的虚拟主机配置
  Listen 80
  DocumentRoot /www/example1
  ServerName www.example1.com
  DocumentRoot /www/example2
  ServerName www.example2.org

  基于IP和多端口的虚拟主机配置
  Listen 172.20.30.40:80
  Listen 172.20.30.40:8080
  Listen 172.20.30.50:80
  Listen 172.20.30.50:8080
  DocumentRoot /www/example1-80
  ServerName www.example1.com
  DocumentRoot /www/example1-8080
  ServerName www.example1.com
  DocumentRoot /www/example2-80
  ServerName www.example1.org
  DocumentRoot /www/example2-8080
  ServerName www.example2.org

  单个IP地址的服务器上基于域名的虚拟主机配置:
  # Ensure that Apache listens on port 80
  Listen 80
  # Listen for virtual host requests on all IP addresses
  NameVirtualHost *:80
  DocumentRoot /www/example1
  ServerName www.example1.com
  ServerAlias example1.com. *.example1.com
  # Other directives here
  DocumentRoot /www/example2
  ServerName www.example2.org
  # Other directives here

  在多个IP地址的服务器上配置基于域名的虚拟主机:
  Listen 80
  # This is the “main” server running on 172.20.30.40
  ServerName server.domain.com
  DocumentRoot /www/mainserver
  # This is the other address
  NameVirtualHost 172.20.30.50
  DocumentRoot /www/example1
  ServerName www.example1.com
  # Other directives here …
  DocumentRoot /www/example2
  ServerName www.example2.org
  # Other directives here …

  在不同的端口上运行不同的站点:
  基于多端口的服务器上配置基于域名的虚拟主机。
  Listen 80
  Listen 8080
  NameVirtualHost 172.20.30.40:80
  NameVirtualHost 172.20.30.40:8080
  ServerName www.example1.com
  DocumentRoot /www/domain-80
  ServerName www.example1.com
  DocumentRoot /www/domain-8080
  ServerName www.example2.org
  DocumentRoot /www/otherdomain-80
  ServerName www.example2.org
  DocumentRoot /www/otherdomain-8080

  基于域名和基于IP的混合虚拟主机的配置:
  Listen 80
  NameVirtualHost 172.20.30.40
  DocumentRoot /www/example1
  ServerName www.example1.com
  DocumentRoot /www/example2
  ServerName www.example2.org
  DocumentRoot /www/example3
  ServerName www.example3.net

  网站泛域名解析
  添加一个虚拟主机配置(如下):
  DocumentRoot d:/web/server110.com # 网站根目录的绝对路径
  ServerName www.server110.com # 网站域名
  ServerAlias *.server110.com # 网站泛域名

原文地址:http://www.server110.com/apache/201310/2783.html

【转】Apache虚拟主机的配置和泛解析域名的绑定的更多相关文章

  1. apache 虚拟主机详细配置:http.conf配置详解

    apache 虚拟主机详细配置:http.conf配置详解 Apache的配置文件http.conf参数含义详解 Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd. ...

  2. Apache虚拟主机的配置

    虚拟主机的配置 基于IP地址的虚拟主机配置Listen 80DocumentRoot /www/example1ServerName www.example1.comDocumentRoot /www ...

  3. Apache虚拟主机(vhost)配置教程

    使用apache来配置虚拟主机,在单一系统上运行多个网站. 现在很多linux主机使用apache作为web服务器的,大部分是基于这个原理来配置虚拟主机的. 下面就windows下以apache 2. ...

  4. Apache 虚拟主机 VirtualHost 配置

    虚拟主机 (Virtual Host) 是在同一台机器搭建属于不同域名或者基于不同 IP 的多个网站服务的技术. 可以为运行在同一物理机器上的各个网站指配不同的 IP 和端口, 也可让多个网站拥有不同 ...

  5. Windows下Apache 虚拟主机 VirtualHost 配置

    以下方式适合原生 Apache, XAMPP 和 WAMP 套件 1.修改Apache配置文件(httpd.conf),如下: # Virtual hostsInclude conf/extra/ht ...

  6. Apache虚拟主机&伪静态配置

    Apache基本操作 安装:yum install httpd 启动:systemctl start httpd 查看进程:ps -ef | grep httpd 查看端口:sudo netstat ...

  7. apache 虚拟主机的配置

    一.基于IP 1. 假设服务器有个IP地址为192.168.1.10,使用ifconfig在同一个网络接口eth0上绑定3个IP: [root@localhost root]# ifconfig et ...

  8. Nginx 虚拟主机 VirtualHost 配置

    Nginx 是一个轻量级高性能的 Web 服务器, 并发处理能力强, 对资源消耗小, 无论是静态服务器还是小网站, Nginx 表现更加出色, 作为 Apache 的补充和替代使用率越来越高. 我在& ...

  9. apache虚拟主机设置泛域名的方法

    在apache虚拟主机中设置泛域名解析,主要是用到ServerAlias 的配置. 1.支持多域名 例如,让mail.jbxue.org.smtp.jbxue.org.pop3.jbxue.org 都 ...

随机推荐

  1. toFixed()方法

    1.定义 toFixed() 方法可把 Number 四舍五入为指定小数位数的数字. 2.示例 Show the number 13.37 with one decimal: <script t ...

  2. @查看MySQL版本的方法

    1.在终端下:mysql -V. [root@localhost bin]# mysql -V; mysql Ver 14.14 Distrib 5.6.21, for Linux (x86_64) ...

  3. Objective-C:KVC机制

    KVC:key value coding    键值对的编码 功能:用来给对象属性设置值或者取出对象属性的值.虽然getter和setter方法也是该功能,但是如果类中没有设置属性特性或者重写这两个方 ...

  4. VP9 Video Codec

    http://www.webmproject.org/vp9/ WebM Repositories libvpx: VP8/VP9 Codec SDK   pull http://git.chromi ...

  5. 怎样推断多个字段组成的keyword在另外一张表中是否存在

    怎样推断多个字段组成的keyword在另外一张表中是否存在 老帅(20141107) 1.首先推断一个keyword在另外一张表中是否存在非常easy! SELECT * FROM a WHERE a ...

  6. Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.7

    导入maven项目时,pom.xml文件报错如下: Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2. ...

  7. python-__init__.py 与模块对象的关系

    python中的Module是比较重要的概念.常见的情况是,事先写好一个.py文件,在另一个文件中需要import时,将事先写好的.py文件拷贝 到当前目录,或者是在sys.path中增加事先写好的. ...

  8. CSS3使用Animation steps属性实现指针时钟效果

    本篇文章由:http://xinpure.com/css3-animation-steps-properties-for-analogue-effects/ animation 默认以 ease 方式 ...

  9. Python: 去掉字符串中的非数字(或非字母)字符

    >>> crazystring = ‘dade142.;!0142f[.,]ad’ 只保留数字>>> filter(str.isdigit, crazystring ...

  10. angularJS 使用自定义指令输出模板

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script sr ...