Index directive not taking effect in case of alias

I would like the pnp4nagios app to be accessed as:
http://server/pnp4nagios/. With this URL it gives a 403 Forbidden error.
It
works when I give: http://server/pnp4nagios/index.php.
What might be wrong?

Here is the pnp4nagios location config:

location ~ /pnp4nagios {
    alias $pnp4nagiosbase/share;
    auth_basic           "Nagios Restricted"; ## Message shown in 

login
window
auth_basic_user_file $nagiosbase/etc/htpasswd.users ; ## See
/etc/nginx/htpassword
index index.php;
try_files $uri $uri/ @handler ; ## If missing pass the URI to
Magento’s front handler

    location ~ /([^\/]*\.php)$ {
        alias  $pnp4nagiosbase/share/$1;
        #include /etc/nginx/fastcgi.conf;
        fastcgi_pass   $fcgipass;
        fastcgi_param  SCRIPT_FILENAME  $fastcgi_script_name;
        include        fastcgi_params; ## See 

/etc/nginx/fastcgi_params
}

    location ~ \.php$ {
        #include /etc/nginx/fastcgi.conf;
        include        fastcgi_params; ## See 

/etc/nginx/fastcgi_params
fastcgi_pass $fcgipass;
}

}

Thanks,
Yash

Posted at Nginx Forum:

You could also define index inside the server block, outside the
location
block:

server {
index index.php;

location …

location …
}

Posted at Nginx Forum:

Hello!

On Wed, Aug 22, 2012 at 07:07:42AM -0400, yashgt wrote:

I would like the pnp4nagios app to be accessed as:
http://server/pnp4nagios/. With this URL it gives a 403 Forbidden error. It
works when I give: http://server/pnp4nagios/index.php.
What might be wrong?

Here is the pnp4nagios location config:

location ~ /pnp4nagios {
    alias $pnp4nagiosbase/share;
  • location ~ /pnp4nagios {
    
  • location /pnp4nagios {
    

[…]

Maxim D.