[Klug-general] Apache2 filename/dir mish-mash

James Morris jwm.art.net at gmail.com
Wed Sep 8 22:13:28 UTC 2010


On 8 September 2010 13:22, Laurence Southon <laurence at southon.uk.net> wrote:
> On 08/09/10 12:26, James Morris wrote:
>> Does anyone know how to make this insane behaviour go away so that [
>> http://localhost/site/index ] and [
>> http://localhost/jwm-art.net/index/somethingrandom ] (etc) generate
>> 404 Not Found errors?
>
> Sounds like you have a wildcard rewrite either in the conf for that site
> or .htaccess.
>
> If you post those here someone will probably be able to spot what is
> going on.


I've edited /etc/apache2/sites_enabled/default (as provided by the
Debian apache2-mpm-prefork 2.2.9-10+l package) to point to my site's
root but otherwise done nothing other than enabled "AllowOverride All"
for it.

Here is the contents of the mods-enabled directory:
alias.conf          authz_groupfile.load  cgi.load      env.load
   php5.conf      status.load
alias.load          authz_host.load       deflate.conf  mime.conf
   php5.load
auth_basic.load     authz_user.load       deflate.load  mime.load
   setenvif.conf
authn_file.load     autoindex.conf        dir.conf
negotiation.conf  setenvif.load
authz_default.load  autoindex.load        dir.load
negotiation.load  status.conf

This doesn't look like modrewrite is enabled. autoindex and dir
control how directory listings appear.

james at Scrapyard:/etc/apache2$ cat sites-available/default
<VirtualHost *:80>
        ServerAdmin webmaster at localhost

        DocumentRoot /home/james/Projects/jwm-art.net/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/james/Projects/jwm-art.net/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /home/james/Projects/jwm-art.net/logs/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /home/james/Projects/jwm-art.net/logs/access.log combined

</VirtualHost>

(admittedly this is a subtly different configuration I had when I
posted earlier, but the same problem persists).

In [ http://localhost/index.php ] I have the following PHP code:

<?php
print("<h2>SERVER</h2>\n");
print("<pre><code>\n");
print_r($_SERVER);
print("</code></pre>\n");
?>

When requesting [ http://localhost/index/poop/?p=code ] index.php
outputs the following:

Array
(
    [HTTP_HOST] => localhost
    [HTTP_USER_AGENT] => Mozilla/5.0 (X11; U; Linux x86_64; en-GB;
rv:1.9.0.19) Gecko/2010072022 Iceweasel/3.0.6 (Debian-3.0.6-3)
    [HTTP_ACCEPT] =>
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_ACCEPT_LANGUAGE] => en-gb,en;q=0.5
    [HTTP_ACCEPT_ENCODING] => gzip,deflate
    [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
    [HTTP_KEEP_ALIVE] => 300
    [HTTP_CONNECTION] => keep-alive
    [HTTP_CACHE_CONTROL] => max-age=0
    [PATH] => /usr/local/bin:/usr/bin:/bin
    [SERVER_SIGNATURE] =>
Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch Server at
localhost Port 80


    [SERVER_SOFTWARE] => Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with
Suhosin-Patch
    [SERVER_NAME] => localhost
    [SERVER_ADDR] => 127.0.0.1
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 127.0.0.1
    [DOCUMENT_ROOT] => /home/james/Projects/jwm-art.net/www
    [SERVER_ADMIN] => webmaster at localhost
    [SCRIPT_FILENAME] => /home/james/Projects/jwm-art.net/www/index.php
    [REMOTE_PORT] => 42938
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => p=code
    [REQUEST_URI] => /index/poop/?p=code
    [SCRIPT_NAME] => /index.php
    [PATH_INFO] => /poop/
    [PATH_TRANSLATED] => /home/james/Projects/jwm-art.net/www/poop/
    [PHP_SELF] => /index.php/poop/
    [REQUEST_TIME] => 1283982784
    [argv] => Array
        (
            [0] => p=code
        )

    [argc] => 1
)

I'll be very pleased if all this provides any clues as to what's going
wrong here!

Cheers,
james.

>
> LS
> --
> Laurence Southon
> Tiger Computing, Bexley
> www.tiger-computing.co.uk
>
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/kent
>



-- 
_
: http://jwm-art.net/
-audio/image/text/code



More information about the Kent mailing list