Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

What's wrong with my VirtualHosts configuration?

Posted on 2003-11-22
10
Medium Priority
?
483 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
ID: 9803248
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
ID: 9804824
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_
ID: 9809610
Shouldn't NameVirtualHost be :

NameVirtualHost *:80

in order to match your VirtualHost blocks ?
0
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 
LVL 17

Expert Comment

by:Tacobell777
ID: 9809633
Ignore my stupid answer, I just got up and didn't fully read the question, all I saw was HOST file....
0
 

Author Comment

by:jchilders_98
ID: 9811036
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_
ID: 9811197
Weird... Anything special in the server logs ? Else, what browser are you using to make the tests ?
0
 

Author Comment

by:jchilders_98
ID: 9820674
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
ID: 9822082
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
ID: 11810436
PAQed, with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

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…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

885 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