Another auth/location question - probably very simple to fix :)
Igor Sysoev
is at rambler-co.ru
Sat Aug 16 12:20:41 MSD 2008
On Sat, Aug 16, 2008 at 01:02:51AM -0700, mike wrote:
> On 8/16/08, Igor Sysoev <is at rambler-co.ru> wrote:
>
> > Do you have something like "location ~ \.php$" before
> > "location ~ /wordpress/admin(.+)" ?
> > If so, the former matchs "/wordpress/admin/post-new.php".
>
> yes i do, here's the entire config:
>
>
> server {
> listen 80;
> server_name foo.com;
> index index.php index.html;
> root /home/mike/web/foo.com/;
> location /wordpress/admin {
> auth_basic "wordpress";
> auth_basic_user_file /home/mike/web/foo.com/.htpasswd;
> location ~ \.php$ {
> fastcgi_pass 127.0.0.1:11000;
> fastcgi_index index.php;
> }
> }
> location ~ \.php$ {
> fastcgi_pass 127.0.0.1:11000;
> fastcgi_index index.php;
> }
> if (!-e $request_filename) {
> rewrite ^(.+)$ /wordpress/index.php?q=$1 last;
> }
> }
Apply the attached patch that allows POST for non-existent static files
and try the following configuration:
server {
listen 80;
server_name foo.com;
index index.php index.html;
root /home/mike/web/foo.com/;
error_page 404 = /wordpress/index.php?q=$request_uri;
location / {
}
location ^~ /wordpress/admin {
auth stuff
location ~ \.php$ {
fastcgi_pass 127.0.0.1:11000;
# fastcgi_index is not needed here
}
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:11000;
# fastcgi_index is not needed here
}
}
}
--
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/modules/ngx_http_static_module.c
===================================================================
--- src/http/modules/ngx_http_static_module.c (revision 1500)
+++ src/http/modules/ngx_http_static_module.c (working copy)
@@ -58,7 +58,7 @@
ngx_open_file_info_t of;
ngx_http_core_loc_conf_t *clcf;
- if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
+ if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {
return NGX_HTTP_NOT_ALLOWED;
}
@@ -71,12 +71,6 @@
return NGX_DECLINED;
}
- rc = ngx_http_discard_request_body(r);
-
- if (rc != NGX_OK) {
- return rc;
- }
-
log = r->connection->log;
/*
@@ -203,6 +197,16 @@
#endif
+ if (r->method & NGX_HTTP_POST) {
+ return NGX_HTTP_NOT_ALLOWED;
+ }
+
+ rc = ngx_http_discard_request_body(r);
+
+ if (rc != NGX_OK) {
+ return rc;
+ }
+
log->action = "sending response to client";
r->headers_out.status = NGX_HTTP_OK;
More information about the nginx
mailing list