zoukankan      html  css  js  c++  java
  • Ubuntu Apache多站点配置

    服务器环境:ubuntu_16, apache/2.4.18

    域名为 www.aaa.com 和 www.bbb.com 的两个站点都部署上去

    环境安装过程略

    修改两处配置

    1.apache配置文件位置  /etc/apache2/sites-available/000-default.conf(相当于本地wampinapacheapache2.4.18confextrahttpd-vhosts.conf)

    打开

    修改为

    <VirtualHost *:80>
    
      ServerAdmin xxx@xx.xxx  
      DocumentRoot 项目路径1
      ServerName www.aaa.com
    
      <Directory "项目路径1">
        Options FollowSymLinks
        AllowOverride All 
        Require all granted
      </Directory>
    
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    </VirtualHost>
    
    <VirtualHost *:80>
    
      ServerAdmin xxx@xx.xxx  
      DocumentRoot 项目路径2
      ServerName www.bbb.com
    
      <Directory "项目路径2">
        Options FollowSymLinks
        AllowOverride All 
        Require all granted
      </Directory>
    
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    </VirtualHost>

    设置不同的ServerName、DocumentRoot 和 Directory 

    2.打开查看 /etc/hosts 文件(相当于本地C:WindowsSystem32driversetchosts)

    默认

    127.0.0.1   localhost

    加上 

    127.0.0.1   www.aaa.com
    127.0.0.1   www.bbb.com

    将项目代码放入对应的 项目路径1 和 项目路径2

    重启apache

    sudo service apache2 restart

    完成,访问测试一下

  • 相关阅读:
    Iaas、Paas、Saas对比分析
    一个不一样的Python教程
    传销的那些年
    availableProcessors is already set to [8], rejecting [8]
    脚本是个好东西
    《设计模式之禅》之桥梁模式
    博文视点之传奇程序员修炼之道观后感
    《设计模式之禅》之享元模式
    《设计模式之禅》之解释器模式
    Git修改commit提交信息
  • 原文地址:https://www.cnblogs.com/yangfei123/p/9803807.html
Copyright © 2011-2022 走看看