POST not allowed (was Re: Location problems)
Igor Clark
igor at pokelondon.com
Thu Mar 6 20:41:21 MSK 2008
Hi folks,
The following configuration is giving me 405 Not Allowed errors when I
try to POST to any URI.
I'm guessing that it thinks the URLs are static, but I don't know why.
Example URI is /admin/clips/edit/63 - but I've tried posting to / with
the same result.
Nothing is written to the error_log, even on "info" or "notice",
though the 405 appears in access_log.
I've tried it with fastcgi_intercept_errors and recursive_error_pages
both off, with the same result.
Any ideas on how to fix it would be very welcome.
Thanks very much!
Igor
server {
listen 80;
server_name my.web.site;
access_log /path/to/logs/access.log main;
error_log /path/to/logs/error.log info;
root /path/to/public;
# enable nginx to serve custom error pages
# on receiving HTTP error codes from back-end
fastcgi_intercept_errors on;
recursive_error_pages on;
# show custom error pages
error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 /500.html;
# deny public access to frontend script
location /frontend.php {
internal;
}
# deny public access to admin script
location /admin.php {
internal;
}
# serve standard files standardly.
# if file not found, fall back to php app using (rewrite if
neceessary) URL
location / {
rewrite ^/$ /financethemes/index;
rewrite ^/speakers/((?!video).+)/?$ /speakers/video/$1;
rewrite ^/financethemes/((?!video|index).+)/?$ /financethemes/video/
$1;
rewrite ^/transcripts/(speaker|theme)/(.+)/?$ /transcripts/view/
$1/$2;
error_page 404 = @phpapp;
}
# serve not found urls using /frontend.php script
location @phpapp {
fastcgi_pass 127.0.0.1:8888;
fastcgi_param SCRIPT_FILENAME $document_root/frontend.php;
fastcgi_param QUERY_STRING CONTROL_PATH=$uri;
include conf/fastcgi_params
}
# IP-restrict anything under /admin
location /admin {
allow 1.2.3.4;
deny all;
rewrite ^/admin/?$ /admin/clips/all;
error_page 404 = @adminapp;
}
# serve admin app using /admin.php;
location @adminapp {
fastcgi_pass 127.0.0.1:8888;
fastcgi_param SCRIPT_FILENAME $document_root/admin.php;
fastcgi_param QUERY_STRING CONTROL_PATH=$uri;
include conf/fastcgi_params;
}
# use the FLV module for flv files
location ~ \.flv$ {
flv;
}
# deny access to .svn dirs
location ~ /\.svn {
deny all;
}
}
More information about the nginx
mailing list