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

Ilan Berkner iberkner at gmail.com
Sun Oct 3 08:50:29 MSD 2010


Thank you all for your responses.

I believe that the missing element in my case was:

alias /usr/local/nagios/share/$1;

in the nagios php processing location, I wasn't aware that I would have to
specify it there as well, but it makes sense now.

Thanks!

On Sun, Oct 3, 2010 at 12:40 AM, Edho P Arief <edhoprima at gmail.com> wrote:

> On Sun, Oct 3, 2010 at 11:31 AM, Ilan Berkner <iberkner at gmail.com> wrote:
> > 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?
> >
> >
>
> >         location /nagios/
> >         {
> >                 root /usr/local/nagios/share;
> >                 index index.php;
> >         }
>
> use alias.
>
> location ~ ^/nagios/(.*\.php)$ {
>  alias /usr/local/nagios/share/$1;
>   fastcgi_pass 127.0.0.1:9000;
>   fastcgi_index index.php;
>  fastcgi_param SCRIPT_FILENAME $request_filename;
>  include fastcgi_params;
> }
> location = /nagios {
>  rewrite ^ /nagios/ permanent;
> }
> location /nagios/ {
>  index index.php;
>  alias /usr/local/nagios/share/;
> }
>
> --
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20101003/ba734243/attachment.html>


More information about the nginx mailing list