zoukankan      html  css  js  c++  java
  • Ubuntu 14.04+Apache2.4 配置多个网站

    首先找到Apache的配置文件 “000-default.conf”

    先这段代码就是配置了2个网站,其中网站“AAA.com”另外一个“BBB.com” 

    再编辑这个文件,如下,下面这是以及配置好了的,其中红色标注是添加进去和改动的。

    NameVirtualHost *:80
    #------------------AAA.com----------------------------------------------------
    <VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com
    
        ServerAdmin webmaster@localhost
        ServerName AAA.com
        ServerAlias  www.AAA.com
        DocumentRoot /var/www/AAA
    
    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>
    #------------------BBB.com----------------------------------------------------
    <VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com
    
        
        ServerAdmin webmaster@localhost
        ServerName BBB.com
        ServerAlias  BBB.com
        DocumentRoot /var/www/BBB.com
    
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>

    其中顶部的

    NameVirtualHost *:80

    是代表开启80端口虚拟化

    其中共色标注地方是有改动的地方,自己解读!

    @疯疯癫癫的半仙
  • 相关阅读:
    c#实现一个打砖块游戏step by step---开篇
    T-SQL语言基础(转载)
    一个经典实例理解继承与多态原理与优点(附源码)---面向对象继承和多态性理解得不够深刻的同学请进
    SQL数据库学习系列之一
    能否优雅解决此编程任务是检验一名开发人员是否已经初具编程思维的分水岭
    C#中的委托和事件(续)
    C# 中的委托和事件(转载)
    任务驱动,学习.NET开发系列第2篇------单词统计
    任务驱动,Winform VS WEB对比式学习.NET开发系列第一篇------身份证解析(不断更新的WEB版本及Winform版本源码)
    Echarts ecomfe 触摸屏 touch 在IE10下无法显示悬浮框
  • 原文地址:https://www.cnblogs.com/izchuan/p/7751690.html
Copyright © 2011-2022 走看看