what's the simplest way to serve php files through an alias?

António P. P. Almeida appa at perusio.net
Sun Oct 3 08:37:00 MSD 2010


On 3 Out 2010 05h31 WEST, iberkner at gmail.com wrote:

> [1 <multipart/alternative (7bit)>] [1.1 <text/plain; ISO-8859-1
> (7bit)>] Thanks for the advice.  When I do it this way, I get an
> error (nginx error log):
>
> 2010/10/03 00:27:33 [error] 20239#0: *6447
> "/usr/local/nagios/share/nagios/index.php" is not found (2: No such
> file or directory)
>
> so you can see that nginx is adding /nagios/ to the end of the root
> directory and so the file is not found (generating a 404 on the
> browser).
>
> What would be the correct way to address this issue?

Using alias:

        location /nagios {
                alias /usr/local/nagios/share;
                index index.php;
        }

Request for nagios gets translated in /usr/local/nagios/share/index.php;

HTH,
--- appa




More information about the nginx mailing list