atom feed28 messages in ru.sysoev.nginxRe: POST not allowed (was Re: Locatio...
FromSent OnAttachments
Matteo NiccoliFeb 19, 2008 1:37 am 
Denis F. LatypoffFeb 19, 2008 2:22 am 
Matteo NiccoliFeb 19, 2008 2:38 am 
Igor ClarkFeb 19, 2008 3:04 am 
Denis F. LatypoffFeb 19, 2008 3:23 am 
Igor ClarkFeb 28, 2008 11:41 am 
Igor SysoevFeb 28, 2008 12:49 pm 
Igor ClarkFeb 29, 2008 1:38 am 
Igor SysoevFeb 29, 2008 2:41 am 
Igor ClarkFeb 29, 2008 3:13 am 
Igor SysoevFeb 29, 2008 3:30 am 
Igor ClarkFeb 29, 2008 7:36 am 
Cliff WellsFeb 29, 2008 11:20 pm 
Igor SysoevFeb 29, 2008 11:47 pm 
Igor ClarkMar 3, 2008 6:07 am 
Igor SysoevMar 3, 2008 6:15 am 
Igor ClarkMar 3, 2008 8:52 am 
Igor SysoevMar 3, 2008 8:55 am 
Igor ClarkMar 3, 2008 9:43 am 
Igor SysoevMar 3, 2008 9:49 am 
Igor ClarkMar 4, 2008 6:13 am 
Igor ClarkMar 6, 2008 9:40 am 
Igor SysoevMar 8, 2008 12:05 pm 
Igor ClarkMar 10, 2008 3:04 am 
Igor SysoevMar 10, 2008 3:28 am.method
Igor ClarkMar 10, 2008 3:51 am 
Igor ClarkMar 31, 2008 11:14 am.conf, .conf, .log
Igor ClarkApr 7, 2008 3:04 am 
Subject:Re: POST not allowed (was Re: Location problems)
From:Igor Sysoev (is-G@public.gmane.org)
Date:Mar 8, 2008 12:05:38 pm
List:ru.sysoev.nginx

On Thu, Mar 06, 2008 at 05:41:21PM +0000, Igor Clark wrote:

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.

Try to change

- error_page 404 = @...; + error_page 404 405 = @...;

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; }

You do not need these rewrite's, use location's. The configuration is bigger, but it's much clearer and so it's scaleable: you can easy add new locations without being afraid to break some rewrite.

However, you may need to use some rewrite's in these locations if you need to rewrite URI to pass into "location ~ \.flv$" with changed URI to match common root.

location = / { index index; root /path/to/public/financethemes; error_page 404 = @phpapp; }

location / { error_page 404 = @phpapp; }

location /speakers/ { alias /path/to/public/speakers/video/; error_page 404 = @phpapp; }

location /speakers/video/ { error_page 404 = @phpapp; }

location /financethemes/ { alias /path/to/public/financethemes/video/; error_page 404 = @phpapp; }

location /financethemes/video/ { error_page 404 = @phpapp; }

location /transcripts/theme/ { alias /path/to/public/transcripts/view/theme/; error_page 404 = @phpapp; }

location /transcripts/speaker/ { alias /path/to/public/transcripts/view/speaker/; 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; } }