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

    完成,访问测试一下

  • 相关阅读:
    数据库
    Python基础
    flask 文件的上传下载和excel操作
    Django 知识点补充
    Django部署时为什么要用 uWSGI与 Nginx? 以及 WSGI,uwsgi等协议
    Memcached 补充
    websocket基本概念
    Tornado 异步非阻塞
    Tornado 自定义session,与一致性哈希 ,基于redis 构建分布式 session框架
    functools 和 itertools
  • 原文地址:https://www.cnblogs.com/yangfei123/p/9803807.html
Copyright © 2011-2022 走看看