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

  • 相关阅读:
    C语言:运算结果保留两位小数
    FFmpeg: AVFrame中的data和extend_data的区别
    android studio: 配置版权信息(转)
    C++: C++11 成员函数作为pthread线程 (转)
    android studio: 取消行注释在第一列
    C 语言 int 读写是否需要加锁
    【转】浅析Linux中的零拷贝技术--简单形象
    【转】Linux 内核态与用户态--简明清晰的介绍
    delete如何找到多重继承对象的内存块起始地址
    【转】内存管理内幕mallco及free函数实现--简易内存分配器、内存池、GC技术
  • 原文地址:https://www.cnblogs.com/top5/p/1491753.html
Copyright © 2011-2022 走看看