View previous topic :: View next topic |
Author |
Message |
nick_ellsworth n00b
Joined: 05 Nov 2004 Posts: 16 Location: Victorville, CA
|
Posted: Fri Sep 30, 2005 1:45 pm Post subject: Another Virtual Hosts Question *SOLVED* |
|
|
Problem: I'm trying to set up Apache with virtual hosts to serve website1.domain1.com and website2.domain2.com
Both of the domain names are part of a service provided by www.dyndns.org because I'm on a connection with a dynamic IP address. When I enter website1.domain1.com into my browser, I get website1. However, when I enter websit2.domain2.com, I get website1.
Could this be due to the DNS server DynDNS uses, or my configuration?
I will provide my httpd.conf upon request.
BTW, I'm using apache-2.0.54-r31 _________________ Registered Linux User #333985
"You don't give blood then take it back again." - Pearl Jam
Last edited by nick_ellsworth on Mon Oct 03, 2005 9:29 am; edited 1 time in total |
|
Back to top |
|
|
tuxmin l33t
Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Fri Sep 30, 2005 6:33 pm Post subject: |
|
|
whats
cat /etc/apache2/conf/vhost(s)/vhost(s).con |grep -v '#' (cant remember whether is vhosts or vhost)
whats cat/etc/apache2/httpd.conf |grep include
ie how is your vhosts.conf file set up and soes httpd.conf include it? _________________ join the optout - http://nhsconfidentiality.org |
|
Back to top |
|
|
nick_ellsworth n00b
Joined: 05 Nov 2004 Posts: 16 Location: Victorville, CA
|
Posted: Fri Sep 30, 2005 8:05 pm Post subject: |
|
|
Code: | ServerRoot "/usr/lib/apache2"
Listen 80
Include /etc/apache2/modules.d/*.conf
DocumentRoot "/var/www/localhost/htdocs"
User apache
Group apache
ServerAdmin nick.ellsworth@gmail.com
ServerName 10.20.1.10
<IfDefine INFO>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>
</IfDefine>
<IfDefine INFO>
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from localhost
</Location>
</IfDefine>
NameVirtualHost 10.20.1.10
NameVirtualHost 10.20.1.10
<VirtualHost 10.20.1.10>
ServerName website1.domain1.com
DocumentRoot /var/www/localhost/htdocs
ServerAdmin nick.ellsworth@gmail.com
</VirtualHost>
<VirtualHost 10.20.1.10>
ServerName website2.domain2.com
DocumentRoot /home/username/public_html
ServerAdmin nick.ellsworth@gmail.com
<Directory /home/nick/public_html>
Options -All -Multiviews
AllowOverride None
Order deny,allow
allow from all
</Directory>
</VirtualHost>
|
I have read numerous HOWTOs and Forum threads, but none seem to fit my problem. I've also tried putting website2 in /var/www/website2/htdocs, but I'm not sure if that's the problem. Thanks in advance for your help! _________________ Registered Linux User #333985
"You don't give blood then take it back again." - Pearl Jam |
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Fri Sep 30, 2005 8:22 pm Post subject: |
|
|
I havent got round to upgrading apache yet -so Ive still got a commonapache2.conf & apache2.conf
the relevant bits that work for me
Code: | grenada config # cat /etc/apache2/conf/apache2.conf |grep vhosts
#If VLOG is defined in conf/vhosts/vhosts.conf, we use this entry
# vhosts directory and modify to suit your needs.
Include conf/vhosts/vhosts.conf
#Include conf/vhosts/dynamic-vhosts.conf
#Include conf/vhosts/virtual-homepages.conf
grenada config # |
id add this to apache2.conf ( if it still exists) or httpd.conf
the vhosts.conf is like this (actual names changed to protect the innocent!)
Code: |
NameVirtualHost *:80
<VirtualHost *:80>
Servername www.server1.com
DocumentRoot /var/www/server1.com/htdocs
DirectoryIndex index.php
ScriptAlias /cgi-bin/ /var/www/server1.com/cgi-bin/
<Directory /var/www/server1.com/cgi-bin>
Options +ExecCGI
</Directory>
</VirtualHost>
<VirtualHost *:80>
Servername domain2.com
DocumentRoot /var/www/domain2.com/htdocs
</VirtualHost>
grenada config # |
_________________ join the optout - http://nhsconfidentiality.org |
|
Back to top |
|
|
nick_ellsworth n00b
Joined: 05 Nov 2004 Posts: 16 Location: Victorville, CA
|
Posted: Fri Sep 30, 2005 8:43 pm Post subject: |
|
|
Basically with the new version of Apache, all the old config files are crammed into httpd.conf You can, however, set up a separate vhosts.conf file and "Include" it from httpd.conf
I've also tried using NameVirtualHost *:80 but Apache won't start. It gives me this error:
Code: | genesis apache2 # /etc/init.d/apache2 restart
* Stopping apache2 ...
[Fri Sep 30 13:38:47 2005] [warn] VirtualHost 10.20.1.10:0 overlaps with VirtualHost 10.20.1.10:0, the first has precedence, perhaps you need a NameVirtualHost directive
[Fri Sep 30 13:38:47 2005] [warn] NameVirtualHost *:80 has no VirtualHosts [ ok ] * Starting apache2 ...
[Fri Sep 30 13:38:48 2005] [warn] VirtualHost 10.20.1.10:0 overlaps with VirtualHost 10.20.1.10:0, the first has precedence, perhaps you need a NameVirtualHost directive
[Fri Sep 30 13:38:48 2005] [warn] NameVirtualHost *:80 has no VirtualHosts [ ok ] |
_________________ Registered Linux User #333985
"You don't give blood then take it back again." - Pearl Jam |
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Sun Oct 02, 2005 12:00 pm Post subject: |
|
|
your virtual host config ?
cat /etc/conf |grep -v '#' of the relevant file
IIRC you need to add a port number to the VH definitions. This changed in apache upgrade a while back.
That may be where the VirtualHost 10.20.1.10:0 ( ie port 0??) is coming from _________________ join the optout - http://nhsconfidentiality.org |
|
Back to top |
|
|
nick_ellsworth n00b
Joined: 05 Nov 2004 Posts: 16 Location: Victorville, CA
|
Posted: Sun Oct 02, 2005 9:02 pm Post subject: |
|
|
Here is the bottom of my httpd.conf, which replaces vhosts.conf
Code: |
NameVirtualHost *:80
<VirtualHost 10.20.1.10>
ServerName website1.domain1.com
DocumentRoot /var/www/localhost/htdocs
ServerAdmin nick.ellsworth@gmail.com
</VirtualHost>
<VirtualHost 10.20.1.10>
ServerName website2.domain2.com
DocumentRoot /home/username/public_html
ServerAdmin nick.ellsworth@gmail.com
<Directory /home/username/public_html>
Options -All -Multiviews
AllowOverride None
Order deny,allow
allow from all
</Directory>
</VirtualHost>
|
_________________ Registered Linux User #333985
"You don't give blood then take it back again." - Pearl Jam |
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Sun Oct 02, 2005 9:33 pm Post subject: |
|
|
try changing each
Code: | <VirtualHost 10.20.1.10> |
to
then /etc/init.d/apache2 restart _________________ join the optout - http://nhsconfidentiality.org |
|
Back to top |
|
|
nick_ellsworth n00b
Joined: 05 Nov 2004 Posts: 16 Location: Victorville, CA
|
Posted: Sun Oct 02, 2005 10:02 pm Post subject: |
|
|
Quote: |
try changing each
Code: |
<VirtualHost 10.20.1.10> |
to
|
I just did that, and although Apache now doesn't spit out any errors on start, I still get website1 when trying to get website2 _________________ Registered Linux User #333985
"You don't give blood then take it back again." - Pearl Jam |
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Mon Oct 03, 2005 6:41 am Post subject: |
|
|
A bit further on then.
Cleared the browser cache?
permissions/owners of websaite 1 and 2 ?
whats in the acces/error log when you access site 1 and then site 2 _________________ join the optout - http://nhsconfidentiality.org |
|
Back to top |
|
|
nick_ellsworth n00b
Joined: 05 Nov 2004 Posts: 16 Location: Victorville, CA
|
Posted: Mon Oct 03, 2005 9:28 am Post subject: |
|
|
Problem solved! I had a "<Directory>" directive that was pointing to the wrong directory for website2.
Thanks for your help along the way. _________________ Registered Linux User #333985
"You don't give blood then take it back again." - Pearl Jam |
|
Back to top |
|
|
|