?
Solved

Apache Virtual Host Problem

Posted on 2003-03-10
5
Medium Priority
?
294 Views
Last Modified: 2013-12-15
Hello again.

Has anyone had any problems with virtual hosts not working in apache. I have a server and it uses IP based virtual hosting. So NameServer 192.168.1.1

<VirtualHost 192.168.1.1>
ServerName www.mynewdomain.com
DocumentRoot /home/mynewdomain.com
<VirtualHost>

Which works fine for the other hosts. The issue is though is www.mynewdomain.com displays the root, www.myOLDdomain.com, servers webpages.

So what might be my problem? I thought that maybe for some reason the DNS server that points to our server is actually pointing to the www.myOLDdomain.com instead of the machines IP. Is this possible? I tried contacting the company but they didn't even respond to my call. or e-mail. I feel lost right now and I can't think of what might be causing this Problem


Can someone help. Thanks


Dez
0
Comment
Question by:EvilPhantom
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:jungle_kp
ID: 8110081
If you are sure your DNS record points to the right ip (which is _not_ 192.168.1.1) then it seems pretty okay. Since i only have one IP i use the following:

<VirtualHost *>
    ServerAdmin some@email.com
    DocumentRoot /path/to/the/site/documentroot/
    ServerName www.mynewdomain.com
    ErrorLog logs/virtual-mynewdomain.com-error_log
    CustomLog logs/virtual-mynewdomain.com-access_log common
</VirtualHost>

You can ofcourse ommit the log commands, but they are nice to have.

one of these for each virtual server, and then the rest will be handled through headers.

Hope this helps.
0
 
LVL 3

Expert Comment

by:naccad
ID: 8111087
I think I need more information, lets see how i understood
your question:-

you have IP based vhosts on apache
you have IP 192.168.1.1 (or whatever)
you have domain1 hosted in /home/domain1
you have domain2 hosted in /home/domain2

when you add the config for domain2 it displays the files
from /home/domain1

am i correct so far?

two questions:
1. did u restart apache after that config change?
2. is domain1 (the old 1) the main server config for that
apache instance? meaning, does domain1 have its own vhost
configuration as well as domain2?

a lot of times i find it easier to configure a vhost for
the primary domain in addition to the regular configuration
and usually i loaded as the 1st vhost.

to clarify,

###BEGIN SAMPLE HTTPD.CONF

ServerName domain1.com
DocumentRoot /home/domain1.com

NameVirtualHost 192.168.1.1

<VirtualHost 192.168.1.1>
  ServerName domain1.com
  ServerAliases www.domain1.com
  DocumentRoot /home/domain1
</VirtualHost>

<VirtualHost 192.168.1.1>
  ServerName domain2.com
  ServerAliases www.domain2.com
  DocumentRoot /home/domain2
</VirtualHost>

###END SAMPLE HTTPD.CONF

hope that helps
tc
-nick
0
 

Author Comment

by:EvilPhantom
ID: 8112322
yes thats completely correct everything is like that and I did restart the server I restarted the system to be sure that it took effect.  I have the configuration working okay for domain1 and domain3 and domain4 etc.  But one of the domains doesn't take accept the settings.  When I ping or nslookup our domain it doesn't ping my server instead it pings a server owned by the company pointing our domain name to our IP.

0
 
LVL 3

Accepted Solution

by:
naccad earned 200 total points
ID: 8112373
Woha there...
Are you telling me you are using a redirection service?

well, there your go

www.domain2.com is NOT pointing to 192.168.1.1
so how do u want apache to force it to point to that ip?

you have to change the DNS entry to make the A record of
domain2.com point to the vhost ip address.

talk to that company, they have it set up wrong, unless you
are hosting with them, your IP address should point to the
host apache is running on.

this is a DNS problem with the "compnay", not with apache.
Call them and tell them you need to change the "A" record
of domain2.com and www.domain2.com to 192.168.1.1 (or whatever)

tc
-nick
0
 

Author Comment

by:EvilPhantom
ID: 8112744
Its what I thought but I wasn't 100% sure.  I didn't setup the DNS entry and as I have been waiting on a Phone call from them I can't do much.  

Thanks

Its very Much appreciated

Dez
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
This article explains how to use the rsync command to create backups and sync data across hosts. Rsync is a very useful command that is often used to copy data, make backups, migrate hosts, and bridge the gap between site staging and production envi…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

594 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