• apache 虚拟主机配置(根据不同的域名映射到不同网站)


      最近弄了台香港服务器做测试,Web服务器软件用的是Apache2.2,机器只有一台,ip只有一个,但是想测试几个站点,于是尝试了下Apache的虚拟主机配置。之前已经写过一篇博文了——《Apache 根据不同的端口 映射不同的站点》,但是,今天在学习微信公众平台的时候,由于微信公众平台只支持80端口,所以无奈,只能尝试根据不同的域名映射不同的站点。

      

    一、修改httpd.conf

      打开Apache的目录,找到httpd.conf文件,分别去掉下面两行文字前面的#号。

     

     #LoadModule vhost_alias_module modules/mod_vhost_alias.s
     #Include conf/extra/httpd-vhosts.conf

    二、修改httpd-vhosts.conf

    打开该文件,看到以下类似内容。虚拟主机的配置也是参照以下内容配置。下面对该内容进行讲解

    <VirtualHost 59.188.244.204>
        ServerAdmin webmaster@dummy-host.www.ronghui66.com
        DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
        ServerName ronghui66.com:80
        
    <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs/2.2/mod/core.html#options
        # for more information.
        #
        Options Indexes FollowSymLinks
    
        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
        AllowOverride None
    
        #
        # Controls who can get stuff from this server.
        #
        Order allow,deny
        Allow from all
    
    </Directory>
        
    #    ServerAlias www.dummy-host.www.ronghui66.com
        ErrorLog "logs/bocai-error.log"
        CustomLog "logs/bocai-access.log" common
    </VirtualHost>
    
    
    #
    # VirtualHost example:
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for all requests that do not
    # match a ServerName or ServerAlias in any <VirtualHost> block.
    #
    <VirtualHost 59.188.244.204>
        ServerAdmin webmaster@dummy-host.www.ronghui66.com
        DocumentRoot "D:/wwwroot/weixin"
        ServerName 0735wmw.com:80
        
    <Directory "D:/wwwroot/weixin">
        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs/2.2/mod/core.html#options
        # for more information.
        #
        Options Indexes FollowSymLinks
    
        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
        AllowOverride None
    
        #
        # Controls who can get stuff from this server.
        #
        Order allow,deny
        Allow from all
    
    </Directory>
        
    #    ServerAlias www.dummy-host.www.ronghui66.com
        ErrorLog "logs/weixin-error.log"
        CustomLog "logs/weixin-access.log" common
    </VirtualHost>

    ServerAdmin 管理员邮箱

    DocumentRoot 网站目录 (注意:如果网站目录中的路径有空格,请在路径两端加上双引号)

    ServerName 要绑定的域名(必填)

  • 相关阅读:
    通用指令-数据库通用操作
    通用指令-key通用操作
    数据类型-sorted_set类型基本操作和扩展操作
    数据类型-set类型基本操作和扩展操作
    数据类型-list类型基本操作和扩展操作
    数据类型-hash类型基本操作和扩展操作
    ORACLE 函数 NVL, NVL2, NULLIF
    maven 配置jdk版本
    maven仓库添加自己的jar包
    Map 中的EntrySet()
  • 原文地址:https://www.cnblogs.com/BTMaster/p/3583588.html
Copyright © 2020-2023  润新知