Solved

What's wrong with my VirtualHosts configuration?

Posted on 2003-11-22
10
461 Views
Last Modified: 2010-04-20
Please help: my Apache web server resolves www.domain2.org to www.domain1.com in spite of the configuration in my httpd.conf (see below). More specifically, when entering www.domain2.org into browser, it brings the index.html from the documentroot of www.domain1.com. How can this be so?

>> From httpd.conf:
# Virtual host Default Virtual Host
NameVirtualHost 68.110.nnn.nnn

<VirtualHost *:80>
  ServerName www.domain1.com
  ServerAlias domain1.com *.domain1.com
  DocumentRoot /var/www/html/ch
  ServerSignature email
  DirectoryIndex  index.php index.html index.htm index.shtml
#  LogLevel  warn
#  HostNameLookups off
</VirtualHost>

<VirtualHost *:80>
  ServerName www.domain2.org
  ServerAlias domain2.org *.domain2.org
  DocumentRoot /var/www/html/fl
  DirectoryIndex  index.php index.html index.htm index.shtml
</VirtualHost>
0
Comment
Question by:jchilders_98
  • 4
  • 2
  • 2
  • +1
10 Comments
 

Author Comment

by:jchilders_98
Comment Utility
As I continue to work on this... what should my etc/hosts file look like; ie. do I need:

  127.0.0.1 domain1 www.domain1.com
  127.0.0.1 domain2 www.domain2.org


??

Thanks in advance for any help...
0
 
LVL 17

Expert Comment

by:Tacobell777
Comment Utility
you only need to work with your host file if your sites are only meant to be seen from that machine, ie. if all machines need to see the sites you would want a DNS Server, if all your internal machines need see the site you'd want to work with some static dns entries in your firewall or router..
0
 
LVL 16

Expert Comment

by:_nn_
Comment Utility
Shouldn't NameVirtualHost be :

NameVirtualHost *:80

in order to match your VirtualHost blocks ?
0
 
LVL 17

Expert Comment

by:Tacobell777
Comment Utility
Ignore my stupid answer, I just got up and didn't fully read the question, all I saw was HOST file....
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:jchilders_98
Comment Utility
I have tried the NameVirtualHost in various configurations including with the *:80 and without, the static IP address (68...), the internal fixed IP (192....); both in the NameVirtualHost and the <VirtualHost ... directives.

Sigh. Still stymied.

Could this be a permissions issue? How can I check to make sure all my file/directory permissions are setup right? Do I need a <Directory block within the <VirtualHost block?
0
 
LVL 16

Expert Comment

by:_nn_
Comment Utility
Weird... Anything special in the server logs ? Else, what browser are you using to make the tests ?
0
 

Author Comment

by:jchilders_98
Comment Utility
I checked the error_log file and found a complaint from mod_unique_id. I disabled it and things progressed. Now, I get the following error when I try to connect to one of my virtual hosts:

>> 400 Bad Request
>> Your browser sent a request that this server could not understand.
>> Reason: You're speaking plain HTTP to an SSL-enabled server port.
>> Instead use the HTTPS scheme to access this URL, please.

My VirtualHosts configuration is now:

  NameVirtualHost *

 <VirtualHost *>
  ServerName www.domain1.com
  DocumentRoot /var/www/html/ch
  ServerSignature email
  Loglevel warn
  HostNameLookups off

  <Directory "var/www/html/ch">
    DirectoryIndex index.php index.html index.htm
    Options +Indexes Multiviews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    Deny from none
   </Directory>
 </VirtualHost>

I have tried setting the ../ch directory and contents to be owned by root.root, apache.apache, nobody.apache, nobody.nobody and it makes no difference. The dir and files are all chmodded to 777.
0
 

Author Comment

by:jchilders_98
Comment Utility
FOUND THE ANSWER

I changed the name of the file:

    /etc/httpd/conf.d/ssl.conf

to:

    ssl.txt

thereby disabling SSL (which I do NOT want) and everything started working. Hope this helps somebody.

JC
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQed, with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now