• apache单ip多域名多目录配置


    自己的vps上放了别人的网站,那怎么样让自己的网站和别人的网站能同时被访问呢?需要使用apache的虚拟主机配置。

    配置httpd.conf文件

    比如原来是这种只是指向一个目录的配置

    DocumentRoot "/opt/lampp/htdocs/ppe112"
    <Directory "/opt/lampp/htdocs/ppe112">
        #
        # 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/trunk/mod/core.html#options
        # for more information.
        #
        #Options Indexes FollowSymLinks
        # XAMPP
        Options Indexes FollowSymLinks ExecCGI Includes
    
        #
        # 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
        # since XAMPP 1.4:
        AllowOverride All
    
        #
        # Controls who can get stuff from this server.
        #
        Require all granted
    </Directory>

    把这段话变成

    <VirtualHost 198.199.107.XXX>       #这里填主机的ip地址
         ServerName www.AAA.com
         DocumentRoot "/opt/lampp/htdocs/AAA"
        <Directory "/opt/lampp/htdocs/AAA">
            #
            # 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/trunk/mod/core.html#options
            # for more information.
            #
            #Options Indexes FollowSymLinks
            # XAMPP
            Options Indexes FollowSymLinks ExecCGI Includes
    
            #
            # 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
            # since XAMPP 1.4:
            AllowOverride All
    
            #
            # Controls who can get stuff from this server.
            #
            Require all granted
        </Directory>
    </VirtualHost>
    
    <VirtualHost 198.199.107.XXX>       #这里填主机的ip地址
         ServerName www.BBB.com
         DocumentRoot "/opt/lampp/htdocs/BBB"
        <Directory "/opt/lampp/htdocs/BBB">
            #
            # 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/trunk/mod/core.html#options
            # for more information.
            #
            #Options Indexes FollowSymLinks
            # XAMPP
            Options Indexes FollowSymLinks ExecCGI Includes
    
            #
            # 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
            # since XAMPP 1.4:
            AllowOverride All
    
            #
            # Controls who can get stuff from this server.
            #
            Require all granted
        </Directory>
    </VirtualHost>

    这样就实现了AAA网站和BBB网站同时在服务器上共存,外部两个域名指向同一个ip,内部解析到不同服务器目录的操作。

    PS:这里这里只能正常访问www.AAA.com  www.BBB.com这两个,如果要直接访问AAA.com  BBB.com 也需要如上再配置一遍。

  • 相关阅读:
    frida rpc调用维护ios手机脚本
    latex表格调整行距
    latex插图自动在双栏的最top,IEEE期刊格式
    latex插图egin{minipage}强制左移hspace命令
    SYNTHIA-RAND-CITYSCAPES数据集云盘下载
    一种用于多张图片同时缩放比较细节的软件faststone
    shopxo安装插件被限制绑定账号的问题
    ShopXo框架去掉绑定商店的提示
    拓扑排序
    前缀和和差分
  • 原文地址:https://www.cnblogs.com/hongchenok/p/3569945.html
Copyright © 2020-2023  润新知