Question

The following makes nginx not to pass to the PHP-FPM fastcgi server because I created a location block:

location = /test.php {
    auth_basic "Nope.";
    auth_basic_user_file /test.htpasswd;
}

location ~* \.php$ {
    try_files $uri =404;

    include params/fastcgi;

    fastcgi_keep_conn on;
    fastcgi_index index.php;
    fastcgi_pass 127.0.0.1:4623;
}

Means: if the first location block matches, it seems that the second one is ignored. Is there any solution for this without copying the fastcgi-stuff from the second location block into the first one?

Was it helpful?

Solution

I'd put all your fastcgi configuration on a file and include it on both locations.

Things like nested locations may prone your configuration buggy and more difficult to understand and maintain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top