Mourning the loss of our friend, WhitPhil.
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Linux and Unix
Tag Cloud
access audio black screen blue screen boot bsod connection crash dell desktop driver drivers dvd email error excel firefox hard drive hardware hdmi hijackthis internet keyboard laptop malware monitor network networking outlook problem ram recovery router screen slow sound spyware tdlwsp.dll trojan upgrade vba video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Apache 2 with virtual hosts and Dyndns

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
Damonw's Avatar
Senior Member with 353 posts.
 
Join Date: May 2001
Location: NSW, Australia
Experience: Advanced
25-Feb-2009, 05:25 AM #1
Apache 2 with virtual hosts and Dyndns
Alright i'm stumped..

I have two domain names, and a dynamic IP address so I've subscribed to Dyndns.com which my router keeps up-to-date.

Anyways, problem is I've got a OpenSUSE 10.3 system running apache 2.2.4, which I have created two virtual hosts to catch each of the domain names.

I have the following in my config file.
Code:
<VirtualHost *>
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com
DocumentRoot /home/damon/public_html/domain1
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>

<VirtualHost *>
ServerName www.domain2.net
ServerAlias domain2.net *.domain2.net
DocumentRoot /home/damon/public_html/domain2
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>
Problem is that it doesn't matter if I enter in either domain1.com, domain2.net or my dyndns hostname I end up at the site for domain1.com

domain1.com
the DNS for this domain are hosted with dyndns and the A records point to my IP (which once again is automatically updated)

domain2.net
the DNS for this one are at afraid.org, im then using a CNAME record to forward it onto my dyndns hostname. so because of the way this one is setup, I would kinda expect domain2.net and the dyndns hostname to end up in the same spot.. but I would have thought it would have at least gone to the virtual host for domain2.net

All i'd like to achieve is different websites hosted on the same server, and the different domains linked to their respective websites.

Can anyone help me with this?

I'm guessing it may have something to do with the Dyndns service?


Oh - just an addition - if I use the servers LAN IP address to access the webserver, it connects me to the default servers page..
__________________
The penalty for jumping off a building is death

Last edited by Damonw : 25-Feb-2009 05:38 AM.
lotuseclat79's Avatar
Distinguished Member with 14,984 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
25-Feb-2009, 08:59 AM #2
Hi DamonW,

Take a look at the Dyndns advisory Virtual Hosting With Apache to see if it helps. Looks like you do not have a "Listen" directive in either host setup.

I don't use Dyndns, so I'm just guessing in my comment above.

Suggest you search for other links on this problem: "Apache +Dyndns +virtual hosts"

-- Tom
__________________
The independence created by philosophical insight is - in my opinion - the mark of distinction
between a mere artisan or specialist and a real seeker after truth. - Einstein 1944
Imagination is more important than knowledge. - Einstein
Squashman's Avatar
Distinguished Member with 14,983 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: IIAHYAYCESA,YAADA!
25-Feb-2009, 09:05 AM #3
I have never had any issues using NO-IP to do this.
Do you have this in your config file.

NameVirtualHost *
Damonw's Avatar
Senior Member with 353 posts.
 
Join Date: May 2001
Location: NSW, Australia
Experience: Advanced
25-Feb-2009, 05:48 PM #4
OK I was missing the NameVirtualServer * bit, so I've added that, and it still didnt work.. so I tweaked the virtual host config a tad..

Code:
<VirtualHost *>
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com
DocumentRoot /home/damon/public_html/domain1
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>
is now

Code:
<VirtualHost domain1.com>
ServerName www.domain1.com
ServerAlias *.domain1.com
DocumentRoot /home/damon/public_html/domain1
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>
so now I can access the correct page if I use http://domain1.com but if I put www.domain1.com I get the default server.. even tho I have the ServerAlias set to *.domain1.com... Unless someone can see a mistake that I've made there I can always just create a 2nd virtual server using the www bit so I can cover both bases.

and using http://domain1.com then once the page loads it shows http://www.domain1.com... strange.
__________________
The penalty for jumping off a building is death
tomdkat's Avatar
Computer Specs
Distinguished Member with 5,019 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
25-Feb-2009, 07:11 PM #5
Slow down a bit. I believe:

NameVirtualHost *

<VirtualHost *>
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com
DocumentRoot /home/damon/public_html/domain1
DirectoryIndex index.php index.html index.htm
</VitrualHost>

<VirtualHost *>
ServerName www.domain2.com
ServerAlias domain2.com *.domain2.com
DocumentRoot /home/damon/public_html/domain1
DirectoryIndex index.php index.html index.htm
</VitrualHost>

is the syntax you want. Could you post all of the VirtualHost definitions you have, from NameVirtualHost down?

Peace...
Damonw's Avatar
Senior Member with 353 posts.
 
Join Date: May 2001
Location: NSW, Australia
Experience: Advanced
25-Feb-2009, 07:56 PM #6
Sure.. heres exactly what I've got.. (with the real domain names)


Code:
NameVirtualHost *
### Virtual server configuration ############################################
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
#Include /etc/apache2/vhosts.d/*.conf
<VirtualHost sausddesigns.com>
ServerName sausddesigns.com
ServerAlias *.sausddesigns.com
DocumentRoot /home/damon/public_html/wwwclients/sausddesigns
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>

<VirtualHost www.sausddesigns.com>
ServerName www.sausddesigns.com
ServerAlias *.sausddesigns.com
DocumentRoot /home/damon/public_html/wwwclients/sausddesigns
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>


<VirtualHost stolemy.net>
ServerName stolemy.net
ServerAlias *.stolemy.net
DocumentRoot /home/damon/public_html/wwwclients/stolemynet
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>

<VirtualHost www.stolemy.net>
ServerName www.stolemy.net
ServerAlias *.stolemy.net
DocumentRoot /home/damon/public_html/wwwclients/stolemynet
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>
tomdkat's Avatar
Computer Specs
Distinguished Member with 5,019 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
25-Feb-2009, 08:59 PM #7
Thanks. Try changing ONE of the sites to be formatted like this:

Code:
<VirtualHost *>
ServerName sausddesigns.com
ServerAlias *.sausddesigns.com
DocumentRoot /home/damon/public_html/wwwclients/sausddesigns
DirectoryIndex index.php index.html index.htm
IndexOptions 
</VirtualHost>
You should also put a special index.html file in each DocumentRoot directory of each host so you can easily identify which VirtualHost definition is being used.

You won't need a VirtualHost definition for "www" subdomains. Also, if you use the "vhosts.d" directory, you can put each VirtualHost definition in its own config file, which keeps the main httpd.conf file from becoming HUGE.

Peace...
Damonw's Avatar
Senior Member with 353 posts.
 
Join Date: May 2001
Location: NSW, Australia
Experience: Advanced
26-Feb-2009, 04:00 AM #8
yeah I did that thanks.... everything still ends up at the sausddesigns.com site..
tomdkat's Avatar
Computer Specs
Distinguished Member with 5,019 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
26-Feb-2009, 10:43 AM #9
One thing I'm noticing is the IP addresses for one of your hosts, stolemy.net, doesn't seem to be right.

Check this out:
Code:
tom@deathstar:~$ dig sausddesigns.com

; <<>> DiG 9.5.0-P2 <<>> sausddesigns.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19916
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;sausddesigns.com.		IN	A

;; ANSWER SECTION:
sausddesigns.com.	60	IN	A	121.44.11.149

;; Query time: 110 msec
;; SERVER: 192.168.2.1#53(192.168.2.1)
;; WHEN: Thu Feb 26 07:39:04 2009
;; MSG SIZE  rcvd: 50

tom@deathstar:~$ dig www.sausddesigns.com

; <<>> DiG 9.5.0-P2 <<>> www.sausddesigns.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52143
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.sausddesigns.com.		IN	A

;; ANSWER SECTION:
www.sausddesigns.com.	43200	IN	CNAME	sausddesigns.com.
sausddesigns.com.	55	IN	A	121.44.11.149

;; Query time: 112 msec
;; SERVER: 192.168.2.1#53(192.168.2.1)
;; WHEN: Thu Feb 26 07:39:09 2009
;; MSG SIZE  rcvd: 68

tom@deathstar:~$ dig stolemy.net

; <<>> DiG 9.5.0-P2 <<>> stolemy.net
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64880
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;stolemy.net.			IN	A

;; ANSWER SECTION:
stolemy.net.		2918	IN	A	67.19.72.202

;; Query time: 50 msec
;; SERVER: 192.168.2.1#53(192.168.2.1)
;; WHEN: Thu Feb 26 07:39:32 2009
;; MSG SIZE  rcvd: 45

tom@deathstar:~$ dig www.stolemy.net

; <<>> DiG 9.5.0-P2 <<>> www.stolemy.net
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49994
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.stolemy.net.		IN	A

;; ANSWER SECTION:
www.stolemy.net.	3600	IN	CNAME	nep.dyndns.info.
nep.dyndns.info.	60	IN	A	121.44.11.149

;; Query time: 167 msec
;; SERVER: 192.168.2.1#53(192.168.2.1)
;; WHEN: Thu Feb 26 07:39:36 2009
;; MSG SIZE  rcvd: 78
I don't know if the discrepancy in IP address for the stolemy.net domain will cause the behavior you described above or not.

Peace...
Damonw's Avatar
Senior Member with 353 posts.
 
Join Date: May 2001
Location: NSW, Australia
Experience: Advanced
27-Feb-2009, 04:10 AM #10
Well its still ending up at my server..

the stolemy.net domains name servers are different, its pointing to afraid.org which then points to dyndns then to me - long way around I know but its free, where I paid for sausddesigns.com to use the dyndns name servers.
Closed Thread Bookmark and Share

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 10:56 PM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.