Solved

What's wrong with my VirtualHosts configuration?

Posted on 2003-11-22
10
479 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
[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
  • 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
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

623 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