[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to modify Apache config to host multiple sites

Posted on 2006-06-01
6
Medium Priority
?
407 Views
Last Modified: 2010-03-04
Hi I would like to modify the config file to host multiple sites and subdomains based on 1 ip address. I am running Apache 2

This is a basic config that I have, I also have some mod_rewrites in place as well, but this is not working:

NameVirtualHost 1.2.3.4
<VirtualHost 1.2.3.4>

 ServerAdmin webmaster@site1.com
 DocumentRoot /deployment/site2/us/
 DirectoryIndex index.html index.htm index.php index.cgi
 ServerName site1.com
 ServerAlias www.site1.com
 ErrorLog /var/log/httpd/us/error_log
 CustomLog /var/log/httpd/us/access_log custom env=!object
</VirtualHost>

NameVirtualHost 1.2.3.4
<VirtualHost 1.2.3.4>

 ServerAdmin webmaster@site2.com
 DocumentRoot /deployment/site2/de/
 DirectoryIndex index.html index.htm index.php index.cgi
 ServerName site2.de
 ServerAlias www.site2.de
 ErrorLog /var/log/httpd/de/error_log
 CustomLog /var/log/httpd/de/access_log custom env=!object
</VirtualHost>


If someone could please point out where the problem is located I would greatly appreciate it!

Thanks,

BB
0
Comment
Question by:baxleyb
  • 3
5 Comments
 
LVL 10

Accepted Solution

by:
sleep_furiously earned 200 total points
ID: 16811696
The "NameVirtualHost" directive should only appear once for any given interface (e.g. 1.2.3.4), but I don't know whether the extra occurence will cause a problem.

What do you mean when you say it is "not working"?  Does that mean the server does not respond?  One site is shown for both hostnames?  Something else?

0
 

Author Comment

by:baxleyb
ID: 16816142
Hi,

Basically I want to host 2 top level domains, 1 .com and 1 .de.

For some reason my configuration will only allow me to host one and some sub-domains.

I hope this makes sense.

Thanks,

BB
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 200 total points
ID: 16823833
replace
  <VirtualHost 1.2.3.4>
by
  <VirtualHost *>
0
 

Author Comment

by:baxleyb
ID: 16948023
i am still working on this, will respond soon.

thanks,

bb
0
 

Author Comment

by:baxleyb
ID: 17147512
I got it to work using this config for each site I wanted to host:

NameVirtualHost 1.2.3.4
<VirtualHost 1.2.3.4>

I will split the points since you both responded.
Thanks.
BB
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month19 days, 16 hours left to enroll

873 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