Another auth/location question - probably very simple to fix :)

On Sun, Aug 17, 2008 at 12:19:50AM -0700, mike wrote:

location ~ /wordpress/wp-admin/.*.php$ {
such little code!

I will try out this patch, but I am curious - why isn’t my existing
method using the plain old /wordpress/wp-admin.* regex an acceptable
workaround (until this “bug” as you’ve said is fixed) - or is this
patch the “fix” for that behavior, if it works?

The three following configuration do not work without the patch:

(yours with regex)

location ~ /wordpress/wp-admin {
auth

   location ~ \.php$ {
      fastcgi
   }

}

location ~ .php$ {
fastcgi
}

(disable regex ^~)

location ^~ /wordpress/wp-admin {
auth

   location ~ \.php$ {
      fastcgi
   }

}

location ~ .php$ {
fastcgi
}

(static locations)

location /wordpress/wp-admin {
auth

   location ~ \.php$ {
      fastcgi
   }

}

location ~ .php$ {
fastcgi
}

Bonjour,

I’m trying to run the admin postfixadmin, I use nginx 0.6.32.

With this:

location ^~ /postfixadmin/admin {
auth_basic “Restricted”;
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
location ~ .php$ {
fastcgi_pass unix:/dev/shm/php2.socket;}
}

After retracted the login / pass, I have this:

The page you are looking for is temporarily unavailable.
Please try again later.

2008/08/17 17:47:04 [error] 32735#0: *144 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.6.11.14, server: 212.3.20.6, request: “GET
/postfixadmin/admin/index.php HTTP/1.1”, upstream:
“fastcgi://unix:/dev/shm/php2.socket:”, host: “vigi.net

2008/08/17 17:47:04 [error] 32735#0: *144 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.6.11.14, server: 212.3.20.6, request: “GET
/postfixadmin/admin/index.php HTTP/1.1”, upstream:
“fastcgi://unix:/dev/shm/php2.socket:”, host: “vigi.net

With that:

location ~ /postfixadmin/admin/.*.php$ {
auth_basic “Restricted”;
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
fastcgi_pass unix:/dev/shm/php2.socket;}

Even result.

Other test:

location ~ /postfixadmin/admin/.*.php$ {
auth_basic “Restricted”;
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
location ~ .php$ {
fastcgi_pass unix:/dev/shm/php2.socket;}}

Résultat => http://img205.imageshack.us/img205/963/adminky5.png

Avec:

location ^~ /postfixadmin/admin {
auth_basic “Restricted”;
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
location ~ .php$ {
fastcgi_pass unix:/dev/shm/php2.socket;}}

2008/08/17 17:59:18 [error] 553#0: *63 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
82.7.11.104, server: 22.4.22.6, request: “GET
/postfixadmin/admin/index.php HTTP/1.1”, upstream:
“fastcgi://unix:/dev/shm/php2.socket:”, host: “vigi.net

2008/08/17 17:59:19 [error] 553#0: *63 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.67.11.104, server: 22.4.22.6, request: “GET
/postfixadmin/admin/index.php HTTP/1.1”, upstream:
“fastcgi://unix:/dev/shm/php2.socket:”, host: “vigi.net

I do not understand :expressionless:

On Sun, Aug 17, 2008 at 05:55:34PM +0200, Mikel Arteta wrote:

2008/08/17 17:47:04 [error] 32735#0: *144 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.6.11.14, server: 212.3.20.6, request: “GET
/postfixadmin/admin/index.php HTTP/1.1”, upstream:
“fastcgi://unix:/dev/shm/php2.socket:”, host: “vigi.net

This is some problem with backend. Try to use TCP.

On Sun, Aug 17, 2008 at 06:53:45PM +0200, Mikel Arteta wrote:

/data/www/postfixadmin/admin$fastcgi_script_name;}}

2008/08/17 18:57:56 [error] 2351#0: *13 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.7.11.04, server: 22.4.22.6, request: “GET /postfixadmin/admin/
HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “vigi.net

2008/08/17 18:57:57 [error] 2351#0: *13 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.7.11.14, server: 22.3.20.6, request: “GET /postfixadmin/admin/
HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “vigi.net

Something wrong with backend: for some reason it resets connection
instead
of response.

This is some problem with backend. Try to use TCP.

I have the same result:

location /postfixadmin/admin {
auth_basic “Restricted”;
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
location ~ .php$ {
fastcgi_pass localhost:9000;
fastcgi_param SCRIPT_FILENAME
/data/www/postfixadmin/admin$fastcgi_script_name;}}

2008/08/17 18:57:56 [error] 2351#0: *13 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.7.11.04, server: 22.4.22.6, request: “GET /postfixadmin/admin/
HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “vigi.net

2008/08/17 18:57:57 [error] 2351#0: *13 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.7.11.14, server: 22.3.20.6, request: “GET /postfixadmin/admin/
HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “vigi.net

This works with version 0.7.10, With the same configuration.

Do you know why ?

Mikel Arteta wrote:

This works with version 0.7.10, With the same configuration.

Do you know why ?
Indeed not.

With this:

location /postfixadmin/admin {
auth_basic “Restricted”;
auth_basic_user_file /usr/local/nginx/conf/htpasswd;

location ~ .php$ {
fastcgi_pass localhost:9000;
fastcgi_param SCRIPT_FILENAME
/data/www/postfixadmin/admin$fastcgi_script_name;}}

It works, but just for url “http://domain.fr/postfixadmin/admin” if you
put “/ postfixadmin/admin/list-admin.php”, more word passes, which is
normal with this configuration.

avec: location ^~ /postfixadmin/admin {
=> http://img205.imageshack.us/img205/963/adminky5.png

Igor S. wrote:

BTW, what is “avec” - in/with ?
Du francais :slight_smile: avec<=>with

Well, with the path that goes well, but I always have the error php-fpm.

location ^~ /postfixadmin/admin/ {
auth_basic “Restricted”;
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
location ~ .php$ {
fastcgi_pass unix:/dev/shm/php2.socket;}}

The page you are looking for is temporarily unavailable.
Please try again later.

2008/08/17 20:17:56 [error] 9456#0: *66 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
82.6.11.104, server: 21.4.22.6, request: “GET
/postfixadmin/admin/list-admin.php HTTP/1.1”, upstream:
“fastcgi://unix:/dev/shm/php2.socket:”, host: “vigi.net

2008/08/17 20:17:56 [error] 9456#0: *66 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.7.111.14, server: 21.4.20.6, request: “GET
/postfixadmin/admin/list-admin.php HTTP/1.1”, upstream:
“fastcgi://unix:/dev/shm/php2.socket:”, host: “vigi.net

I not understand this error php-fpm.

On Sun, Aug 17, 2008 at 07:29:43PM +0200, Mikel Arteta wrote:

auth_basic_user_file  /usr/local/nginx/conf/htpasswd;

avec: location ^~ /postfixadmin/admin {
=> http://img205.imageshack.us/img205/963/adminky5.png

This is bug in 0.7.x - it does not pass request to fastcgi in this
configuration, so you do not see reset connection.
The attached patch fixes the bug.

BTW, what is “avec” - in/with ?

On Sun, Aug 17, 2008 at 08:17:09PM +0200, Mikel Arteta wrote:

fastcgi_pass unix:/dev/shm/php2.socket;}}
2008/08/17 20:17:56 [error] 9456#0: *66 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
8.7.111.14, server: 21.4.20.6, request: “GET
/postfixadmin/admin/list-admin.php HTTP/1.1”, upstream:
“fastcgi://unix:/dev/shm/php2.socket:”, host: “vigi.net

I not understand this error php-fpm.

This is backend error and probably php-fpm related, try to ask in
http://groups.google.com/group/highload-php-en

On 8/17/08, Igor S. [email protected] wrote:

This is backend error and probably php-fpm related, try to ask in
http://groups.google.com/group/highload-php-en

I use php-fpm with 5.2.6 right now - no problem whatsoever. using TCP.

in fact, it’s been better with nginx + php-fpm, before I was having
random 500 bad gateway issues with zeus and could not debug it since
it was closed source…

I’d recommend upgrading to the latest everything :slight_smile: