zoukankan      html  css  js  c++  java
  • 【转】Apache虚拟主机的配置和泛解析域名的绑定

    基于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

  • 相关阅读:
    windows下部署MySQL 8.0.11
    基于beego构建Restful API服务
    Go 并发
    Go语言的面向对象(OOP)
    Go基础语法纪要
    软件工程基础图式(第四章 系统设计-面向过程的系统设计)
    概率论与数理统计图式(第三章 多维随机变量)
    编译技术图式(第四章 语法分析)01文法和语法的定义
    计算机组成原理和结构图式(第三章 CPU子系统)
    Java图式(第三章 流程控制、数组)
  • 原文地址:https://www.cnblogs.com/yuanzai12345/p/5976099.html
Copyright © 2011-2022 走看看