Discussion:
[PHP-INSTALL] Weird virtual host error
Richard Heyes
2008-07-21 20:19:48 UTC
Permalink
Hi,

Got a strange error to do with Apache and virtual hosts.
http://www.bioscience.co.uk and http://staging.bioscience.co.uk are both
the same machine and PHP is clearly working on the default (www...) but
not on the (only) virtual host (staging...)

The virtual host config is thus:

<VirtualHost 62.233.101.227:80>
ServerName staging.bioscience.co.uk

DocumentRoot /var/www/vhosts/staging/htdocs

CustomLog logs/staging.bioscience.co.uk-access_log combined
ErrorLog logs/staging.bioscience.co.uk-error_log
</VirtualHost>

Is this even correct? Thanks.
--
Richard Heyes
http://www.phpguru.org
Richard Heyes
2008-07-21 20:52:49 UTC
Permalink
should be good - i normally have documentroot above servername - not
sure if that matters, though
No difference unfortunately.

PS. Is there an Apache "debug" mode that could help with trying to solve
this issue?
--
Richard Heyes
http://www.phpguru.org
Keith Roberts
2008-07-22 09:20:22 UTC
Permalink
Subject: [PHP-INSTALL] Weird virtual host error
Hi,
Got a strange error to do with Apache and virtual hosts.
http://www.bioscience.co.uk and http://staging.bioscience.co.uk are both
the same machine and PHP is clearly working on the default (www...) but
not on the (only) virtual host (staging...)
<VirtualHost 62.233.101.227:80>
ServerName staging.bioscience.co.uk
DocumentRoot /var/www/vhosts/staging/htdocs
CustomLog logs/staging.bioscience.co.uk-access_log combined
ErrorLog logs/staging.bioscience.co.uk-error_log
</VirtualHost>
Is this even correct? Thanks.
--
Richard Heyes
http://www.phpguru.org
Hi Richard. Maybe you would like to use my httpd.conf VH
definitions as a template to setup your own VH?

# virtual host definitions

# needs to be the IP number of the network card interface
# NOT my public IP address 81.168.74.150
NameVirtualHost 10.0.0.1

#-----------------------------------------------------------------

# default virtual host

#<VirtualHost 10.0.0.1>
# ServerName www.karsites.net
#</VirtualHost>

# default virtual host - karsites

<VirtualHost 10.0.0.1>
# any required directives not set in this VH container
# will default to the global values
# set outside this or any other VH containers
ServerName www.karsites.net
ServerAlias karsites.net
DocumentRoot /websites/live/karsites
</VirtualHost>

<Directory /websites/live/karsites>
# DirectoryIndex /home/anyuser/newsite-ETA.php
DirectoryIndex /home/anyuser/home.php
Options None
Order deny,allow
Allow from all
php_admin_flag display_errors OFF
</Directory>

#-----------------------------------------------------------------
# virtual host www.php-debuggers.net

<Directory /websites/live/php-debuggers>
# DirectoryIndex /home/anyuser/newsite-ETA.php
DirectoryIndex /home/anyuser/home.php
Options None
# Options Indexes
Order deny,allow
Allow from all
php_admin_flag display_errors OFF
</Directory>

<VirtualHost 10.0.0.1>
ServerName www.php-debuggers.net
ServerAlias php-debuggers.net
ServerAdmin ***@php-debuggers.net
DocumentRoot /websites/live/php-debuggers
</VirtualHost>

#-----------------------------------------------------------------
# virtual host www.raised-from-the-dead.org.uk

<Directory /websites/live/raised-from-the-dead>
# DirectoryIndex /home/anyuser/newsite-ETA.php
DirectoryIndex /home/anyuser/home.php
Options None
# Options Indexes
Order deny,allow
Allow from all
php_admin_flag display_errors OFF
</Directory>

<VirtualHost 10.0.0.1>
ServerName www.raised-from-the-dead.org.uk
ServerAlias raised-from-the-dead
ServerAdmin ***@raised-from-the-dead.org.uk
DocumentRoot /websites/live/raised-from-the-dead
</VirtualHost>

and my /etc/host file looks like:

# Fedora 8 /etc/host file
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#

127.0.0.1 localhost

# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback

fe00::0 ipv6-localnet

ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts

10.0.0.1 www.karsites.net karsites.net karsites
10.0.0.1 www.php-debuggers.net php-debuggers.net
php-debuggers
10.0.0.1 www.raised-from-the-dead.org.uk
raised-from-the-dead.org.uk
10.0.0.1 raised-from-the-dead

Using the above domain name mappings allows me to access my
virtual host definitions from localhost. Without these
mappins my machine would try an internet DNS lookup on my
own hostnames - which will not work.

HTH

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

The mind of the prudent is ever getting knowledge, and the
eear of the wise is ever seeking, inquiring for and craving
knowledge. Pr. 18:15 Amp

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
Richard Heyes
2008-07-25 09:11:51 UTC
Permalink
...
Thanks all, found the problem (I think). For some reason the PHP
engine was being turned off (?). Very bizaare. Might have beeen
something to do with Plesk, not sure.
--
Richard Heyes
http://www.phpguru.org
Daniel Brown
2008-07-25 17:51:27 UTC
Permalink
Post by Richard Heyes
...
Thanks all, found the problem (I think). For some reason the PHP
engine was being turned off (?). Very bizaare. Might have beeen
something to do with Plesk, not sure.
When it comes to Plesk, who knows? :-\
--
</Daniel P. Brown>
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.
Loading...