?
Solved

Apache2 - how to configure 2 virtual hosts (name based)

Posted on 2005-04-11
10
Medium Priority
?
222 Views
Last Modified: 2013-11-18
Hi All,

I am new to Linux, started a week ago to install debian woody than decided to go with Sarge. All went reasonably OK with the ADLS proxy IPTables Apache, etc. Now I have decided to install apache2. So I did. And here I am trying to configure two virtual hosts.

Primarily I cant beleive the way the information is presented in the documentation, but I can't even find what I need...

The old Apache config was simple. Two sections related to the two virtual hosts had to be added in httpd.conf and that was it....

Now I dont even know where should it go. The information I have found (in doc and exaples on the net ) is conflicting at best

Consider I have two domains, domain1.com.au and domain2.com.au. Both are set up on the same IP address and ports, what and where should go... assuming that I have a completely clean install of Apache2 on Debian Sarge.

TIA,

Tom
0
Comment
Question by:tom_szabo
  • 6
  • 3
10 Comments
 
LVL 27

Assisted Solution

by:caterham_www
caterham_www earned 600 total points
ID: 13757359
> Two sections related to the two virtual hosts had to be added in httpd.conf and that was it....

Open /etc/apache2/httpd.conf (which might be empty) and place there


NameVirtualHost *

<VirtualHost *>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com
    ServerName domain1.com.au
    ServerAlias www.domain1.com.au
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com
    ServerName domain2.com.au
    ServerAlias www.domain2.com.au
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

0
 

Author Comment

by:tom_szabo
ID: 13758434

I have added this to httpd.conf:

NameVirtualHost *

<VirtualHost *>
    ServerAdmin webmaster@ifss.com.au
    DocumentRoot /var/www/ifss.com.au/docs/
    ServerName ifss.com.au
    ServerAlias www.ifss.com.au
    ErrorLog /var/www/ifss.com.au/logs/error.log
    CustomLog /var/www/ifss.com.au/logs/access.log common
</VirtualHost>

<VirtualHost *>
    ServerAdmin webmaster@gotomypc.com.au
    DocumentRoot /var/www/gotomypc.com.au/docs/
    ServerName gotomypc.com.au
    ServerAlias www.gotomypc.com.au
    ErrorLog /var/www/gotomypc.com.au/logs/error.log
    CustomLog /var/www/gotomypc.com.au/logs/access.log common
</VirtualHost>

..and I get this:

Reloading web server config...[Mon Apr 11 10:25:32 2005] [warn] NameVirtualHost*:0 has no VirtualHosts
done.

Why?
What else is missing?

TIA,

Tom
0
 
LVL 1

Expert Comment

by:arjecahn
ID: 13774066
Try adding
<VirtualHost *:80>

Do you have "Listen" set correctly?
Set it, above your VirtualHosts declarations, to

Listen 0.0.0.0:80
0
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!

 

Author Comment

by:tom_szabo
ID: 13780334
No, sorry but did not help, the message is still there!
0
 

Author Comment

by:tom_szabo
ID: 13780344
Should correct, it actually did not even work, could not start the server if either of those were added!

0
 
LVL 1

Expert Comment

by:arjecahn
ID: 13780409
Tom, could you post your full httpd.conf?
0
 

Author Comment

by:tom_szabo
ID: 13780438
That is it!

The original Apache.conf has not been touched. This is all what I have added....

The server seem to work, but comes up with the message...
0
 

Author Comment

by:tom_szabo
ID: 13780468
This si something I don't understand:
.....
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/[^.#]*


This is the end of the Apache2.conf file, and it means (to me) that now we include the files in the Sites-enabled folder. That is left untouched also.

But where is the include for the httpd.conf??? or is that automatic?
0
 
LVL 1

Accepted Solution

by:
arjecahn earned 900 total points
ID: 13782402
Apache.conf is probably your httpd.conf file.
What happens if you take out the Include statement and restart Apache? Does it still give the error?
If it doesn't, you're sure it's in one of the included files.
BTW, what files do you have in sites-enabled?
0
 

Author Comment

by:tom_szabo
ID: 13796701
The solution is that one has to remove the line

>> NameVirtualHost *

from httpd.conf and move this one line into apache.conf and make sure that there is no more in the config files...

thanks the help anyway
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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

807 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