Solved

What's wrong with my VirtualHosts configuration?

Posted on 2003-11-22
10
475 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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