Apache Configuration

Alex Dean alex at crackpot.org
Wed Jul 6 18:51:36 MST 2011


On Jul 6, 2011, at 6:50 PM, Steve Phariss wrote:

> I have a test apache install with several Virtual hosts,  I am trying to install myPhpAdmin in a directory off of /var/www but I can not get it to be recognized (404 error)
> 
> the virtual host contents are in directories off of /var/www (i.e. /var/www/www.myurl.com and /var/www/phpMyAdmin-3.4.3.1-english
> 
> The server is working correctly and serving the appropriate domains, I just can not get www.myurl.com/phpMyAdmin-3.4.3.1-english to work......
> 
> Any help would be great......
> 
> <VirtualHost *:80>
>     ServerAdmin *********************
>     ServerName www.myurl.com
>     DirectoryIndex index.html #index.mhtml
>     DocumentRoot /var/www/www.myurl.com
>     AddType  text/html  .html #.mhtml
>         # Set Perl Variable SiteName with name of site for handler.pl
>         #PerlSetVar site myurl
>         #PerlRequire /var/www/handler.pl
>     <LocationMatch "(\.html|\.txt|\.pl|\.mhtml|dhandler|autohandler)$">
>       #SetHandler perl-script
>       #PerlHandler HTML::Mason
>     </LocationMatch>
>     <DirectoryMatch "/var/www/phpMyAdmin-3.4.3.1-english">
>       AllowOverride All
>       Options None
>       Order allow,deny
>       Allow from all
>     </DirectoryMatch>
>     ScriptAlias /cgi-bin/ "/var/www/www.myurl.com/cgi-bin/"
>     <Directory "/var/www/www.myurl.com/cgi-bin">
>       AllowOverride All
>       Options None
>       Order allow,deny
>       Allow from all
>     </Directory>
>     ErrorLog syslog:local1
>     ErrorLog /var/log/httpd/www.myurl.com.error
> CustomLog /var/log/httpd/www.myurl.com.access common
> </VirtualHost>
> 
> <VirtualHost *.80>
> .
> .
> .
> </VirtualHost>


If your DocumentRoot is /var/www/www.myurl.com, you normally won't be able to browse /var/www/phpMyAdmin-3.4.3.1-english since that directory is not under your DocumentRoot.  http://www.myurl.com/phpMyAdmin-3.4.3.1-english would map to /var/www/www.myurl.com/phpMyAdmin-3.4.3.1-english on your filesystem, which apparently doesn't exist.  Your DirectoryMatch cannot override that restriction.

A few options:
 - Move or symlink your content so /var/www/www.myurl.com/phpMyAdmin-3.4.3.1-english exists.
 - Leave your files where they are, and use Apache's Alias directive.

Watch your access logs while your debugging, to ensure that the correct virtual host is actually servicing your request.  It's possible that some misconfiguration is causing your requests to be served from the default virtual host.  'httpd -S' (or whatever the Debian equivalent is) will show you how Apache parsed your virtual host directives.

alex


More information about the PLUG-discuss mailing list