• Apache配置基于域名 tomcat虚拟主机配置


    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerName cms.demo.***.net.cn
        ProxyPreserveHost On
        ProxyRequests Off

        ProxyPass 
    / http://192.168.2.73:8081/
        ProxyPassReverse / http://192.168.2.73:8081/

        ErrorLog logs
    /cms.demo.***.net.cn_error_log
        CustomLog logs
    /cms.demo.***.net.cn_access_log common
    </VirtualHost>

    <VirtualHost *:80>
        ServerName portal.demo.***.net.cn
        ProxyPreserveHost On
        ProxyRequests Off

        ProxyPass 
    / http://192.168.2.70/
        ProxyPassReverse / http://192.168.2.70/

        ErrorLog logs
    /cms.demo.***.net.cn_error_log
        CustomLog logs
    /cms.demo.***.net.cn_access_log common
    </VirtualHost>


    参考资料:

    1、基于主机名的虚拟主机http://www.phpchina.com/manual/apache/vhosts/name-based.html

    2、apache多域名转发至tomcat&https设置&虚拟主机的设置

        http://blog.csdn.net/stewart/article/details/6336374

        重点参考:

    <VirtualHost *:80>
        ServerName wap.xxx.com
        ProxyPreserveHost On
        ProxyRequests Off

        ProxyPass / http://localhost:9080/
        ProxyPassReverse / http://localhost:9080/

        ErrorLog logs/wap.xxx.com_error_log
        CustomLog logs/wap.xxx.com_access_log common
    </VirtualHost>

        3、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 
  • 相关阅读:
    使用SSIS汇集监控数据
    centos 6.7安装与配置vncserver
    MySQL问题记录--Can't connect to MySQL server on localhost (10061)解决方法
    django学习记录--第一个网页“hello django”
    【转】Python 日期和时间
    【转】Mysql中varchar存放中文与英文所占字节异同
    MySQL学习笔记--基本操作
    MySQL学习笔记--数据类型
    Linux 下安装pip
    【转】CentOS 6.5安装pyspider过程记录
  • 原文地址:https://www.cnblogs.com/jifeng/p/2154670.html
Copyright © 2020-2023  润新知