Welcome! Log In Create A New Profile

Advanced

Re: auth_basic restricted files with php

February 04, 2011 10:51AM
I know this is old, but for those still finding this in search engines, thats not the 'correct' fix, though it could work, The problem us using a root path inside of the location block, if you move the root outside of location and into the server { } block, then there is no need to have a duplicated nested php block, nor is there a need to manually define the document root since $document_root would be correctly filled by that point.

ie:


server {

listen 80;
server_name myserver.es;
root /usr/local/nginx/htdocs;

location ~*/apc {
auth_basic "Restricted";
auth_basic_user_file /usr/local/nginx/htdocs/.htpasswd;
}

location ~\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;

#if the line isn't already in fastcgi_params
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;
}
}
Subject Author Posted

auth_basic restricted files with php

clinisbud April 12, 2010 10:25AM

Re: auth_basic restricted files with php

clinisbud April 13, 2010 02:40AM

Re: auth_basic restricted files with php

kblessinggr February 04, 2011 10:51AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready