Solved

How to enable multi-domain sites hosted on the same appache?

Posted on 2012-04-08
2
319 Views
Last Modified: 2012-06-21
Now, I have one server, I want to host more and more websites on the same machine.
The server runs zend server ce (appache2)
Assuming three sites: www.a.com and www.b.com and www.c.com they will both runs on the server.
a.com will have the root directory of the appache;
b.com will have the htdocs/b/ directory, c.com will have the htdocs/c/ directory.
Who can tell me the detail configuration steps to implement that?

Thanks
0
Comment
Question by:matiascx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 21

Accepted Solution

by:
Papertrip earned 500 total points
ID: 37821344
This is very common and is pretty straight forward.  For a basic vhost you only need to make a few changes.

Check out this page first http://httpd.apache.org/docs/2.0/vhosts/
If each website will have it's own IP then use IP-based virtual hosting, if they will share the same IP then use name-based.

The DocumentRoot option says where on the server the content will reside on the filesystem for any given vhost.

More info -- http://httpd.apache.org/docs/2.0/vhosts/examples.html

Name-based example:
# Ensure that Apache listens on port 80
Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example1.com

# Other directives here

</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example2.org

# Other directives here

</VirtualHost> 

Open in new window

0
 

Author Comment

by:matiascx
ID: 37826872
Hi, Papertrip,
Thanks to your information, I have succesfully solve the problem. But a new question:
Now, www.a.com ->htdocs/a/  , I have the requirement that: when the user enter www.a.com/root SHOULD be rooted to the htdocs/root  NOT the htdocs/a/root.   How can I implement that?

Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
dig @8.8.8.8 A google.com +trace gets timeout in my mac sierra 2 39
Reverse Proxy problem 3 32
Cannot access website or email server 4 83
How can I split a variable 19 43
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question