zoukankan      html  css  js  c++  java
  • Virtual Host on Apache(Apache上建立虚拟主机)

    0. Introduction

    Usually, we want to build two or more websites on a web server, but we have only one IP and do not want to use ports (eg. www.abc.com:8081) to visit webpages.

    So, how to make www.a.com and www.b.com both point to server X.X.X.X ?

    1. Environment

    Ubuntu 14.04 x64

    Bitnami LAMP Stack 5.4.40

    2. Steps

    2.0. Configure "A" records of www.a.com and www.b.com to IP X.X.X.X

    2.1. Make new dirs in .../apache2/htdocs for these two sites, such as, htdocsa and htdocsb

    2.2. Modify .../apache2/conf/httpd.conf, add following codes:

    NameVirtualHost X.X.X.X
    
    <VirtualHost X.X.X.X:80>
    ServerAdmin admin@a.com
    DocumentRoot /opt/lampstack-5.4.40-0/apache2/htdocs/htdocsa
    ServerName www.a.com
    </VirtualHost>
    
    NameVirtualHost X.X.X.X
    <VirtualHost X.X.X.X:80>
    ServerAdmin admin@b.com
    DocumentRoot /opt/lampstack-5.4.40-0/apache2/htdocs/htdocsb
    ServerName www.b.com
    </VirtualHost>

    2.3. Restart apache

    3. References

    http://www.cnblogs.com/wpjsolo/archive/2012/01/19/2327457.html

    http://www.xker.com/page/e2010/0925/98279.html

    (This article is from http://www.cnblogs.com/chenyineng/p/4450978.html, and belongs to http://chenyineng.cnblogs.com and http://www.chenyineng.info)

  • 相关阅读:
    扩展VirtualBox虚拟机磁盘容量
    Java实现莱布尼兹问题
    Java实现子序列问题
    Java实现子序列问题
    Java实现子序列问题
    Java实现子序列问题
    Java实现子序列问题
    第九届蓝桥杯JavaC组省赛真题
    第九届蓝桥杯JavaC组省赛真题
    第九届蓝桥杯JavaC组省赛真题
  • 原文地址:https://www.cnblogs.com/chenyineng/p/4450978.html
Copyright © 2011-2022 走看看