So is "rewrite_by_lua" also evil?
Nginx User
nginx at nginxuser.net
Thu Oct 13 04:52:25 UTC 2011
On 13 October 2011 07:30, Nginx User <nginx at nginxuser.net> wrote:
> On 13 October 2011 04:34, agentzh <agentzh at gmail.com> wrote:
>> The debug log data you've provided contains a lot of references to the
>> location @pretty_urls which is missing from your original nginx.conf
>> snippet. Could you please provide a minimized but complete nginx.conf
>> that can reproduce this problem as well as the corresponding debug.log
>> snippet?
>
> server {
> ...
> location @pretty_urls {
> # some rewrite rules to php
> }
> location @proxy {
> include /etc/nginx/firewall.default;
> proxy_pass http://127.0.0.1:8080;
> ...
> }
> location ~ ^.+\.php$ {
> content_by_lua 'ngx.exec("@proxy");';
> }
> location / {
> try_files $uri $uri/ @pretty_urls;
> }
> }
>
> If request ends in ".php" it is sent to @proxy by php location. If not
> ".php", Nginx tries to find and serve resource. If not found, sent to
> @pretty_urls where it will either be rewritten to ".php" or a 404
> error returned.
>
PS: I had earlier thought the issue might be with the content_by_lua
'ngx.exec("@proxy");'; line but when I tried to use the following ...
location ~ ^.+\.php$ {
rewrite_by_lua 'ngx.exec("@proxy");';
}
... which I thought should work and seems more appropriate, I got an
error equivalent to issuing "return 444".
More information about the nginx
mailing list