?
Solved

Apache Virtual Host Problem

Posted on 2003-03-10
5
Medium Priority
?
293 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
[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
  • 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

741 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