Welcome! Log In Create A New Profile

Advanced

Disable auth_basic for unique (set of) URL

B.R.
December 27, 2012 08:38AM
Hello,

I am using the auth_basic directive to restrict access to a whole server
(auth_basic server-wide set, not in any particular location).
Since I am using php, I am also using:

location ~ \.php$ {
FastCGI stuff here...
}

to forward my request to the PHP application.

Now, I would like to remove the auth_basic authentication for a very unique
and specific location: thisfile.php

I first tried:

location ~ \.php$ {
location = /thisfile.php {
auth_basic off;
}
FastCGI stuff here...
}

but Nginx said:
nginx: [emerg] location "/thisfile.php" is outside location "\.php$" in
..../nginx/conf.d/mystupid.conf:69
nginx: configuration file .../nginx/nginx.conf test failed

I then tried:

location ~ \.php$ {
location ~ ^/thisfile.php$ {
auth_basic off;
}
FastCGI stuff here...
}

But of course now the FastCGI part does not server the request and the PHP
file is sent for download...

What king of clean solution do I have?
Am I forced to place the auth_basic in all my 'location' blocks but one,
which would be for 'thisfile.php'?

Thanks,
---
*B. R.*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Disable auth_basic for unique (set of) URL

B.R. December 27, 2012 08:38AM

Re: Disable auth_basic for unique (set of) URL

B.R. December 27, 2012 10:00AM

Re: Disable auth_basic for unique (set of) URL

Francis Daly December 29, 2012 12:36PM

Re: Disable auth_basic for unique (set of) URL

B.R. December 29, 2012 02:50PM

Re: Disable auth_basic for unique (set of) URL

Francis Daly December 29, 2012 04:52PM

Re: Disable auth_basic for unique (set of) URL

B.R. December 29, 2012 07:28PM

Re: Disable auth_basic for unique (set of) URL

Francis Daly December 30, 2012 06:18AM

Re: Disable auth_basic for unique (set of) URL

B.R. December 30, 2012 04:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 275
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready