I have commented the following 4 directives in my server declaration, that
now looks like as below, and it seems to work better.

open_file_cache          max=1000 inactive=20s;
open_file_cache_valid    30s;
open_file_cache_min_uses 2;
open_file_cache_errors   on;

-------------------------------------
in /etc/nginx/sites-available/mydomain


server {
  listen [::]:443 ssl spdy;
  listen 443 ssl spdy;
  server_name mydomain;

  charset utf-8;

# these includes are taken from https://github.com/h5bp/server-configs-nginx
include /etc/nginx/h5bp/directive-only/ssl.conf;
include /etc/nginx/h5bp/directive-only/spdy.conf;
include /etc/nginx/h5bp/directive-only/ssl-stapling.conf;
include /etc/nginx/h5bp/directive-only/x-ua-compatible.conf;
include /etc/nginx/h5bp/directive-only/extra-security.conf;
include /etc/nginx/h5bp/location/protect-system-files.conf;

# these 4 are now commented, it seems now to work better
# open_file_cache          max=1000 inactive=20s;
# open_file_cache_valid    30s;
# open_file_cache_min_uses 2;
# open_file_cache_errors   on;


  location /nginx_status {
    stub_status on;
    access_log   off;
    deny all;
  }

    location / {
        uwsgi_pass      unix:///tmp/web2py.sock;
        include         uwsgi_params;
        uwsgi_param     UWSGI_SCHEME $scheme;
        uwsgi_param     SERVER_SOFTWARE    nginx/$nginx_version;
         include /etc/nginx/conf.d/web2py/gzip.conf;
    }

  location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
      alias /home/www-data/web2py/applications/$1/static/$2;
      expires max;
      log_not_found off;
      include /etc/nginx/conf.d/web2py/gzip_static.conf;
  }
}


If you catch anything bad with this configuration, please let me know.
Thank you


On Tue, Feb 3, 2015 at 7:06 AM, Michele Comitini <michele.comit...@gmail.com
> wrote:

>
>
> Il giorno lunedì 2 febbraio 2015 12:29:00 UTC+1, alex ha scritto:
>>
>> Michele,
>>
>> Thank you for quick answer!
>>
>> If I put in nginx server directive:
>>
>> location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc
>> break ; }
>>
>> and leave web2py/applications/app/routes.py with only
>>
>> routes_out = (
>>     ('/app/ctr/fnc', r'/AAA'),
>> )
>>
>> everytime I call /AAA it gets rewritten to /app/ctr/fnc.
>> Instead, I would like to see always /AAA
>>
>>
>>
> I think you should post a minimal "server" directive to reproduce the
> problem.
> Don't use complete URI's (i.e. with https part) or you are likely to get
> an http redirection. This should get closer to you need:
>
> location /AAA { rewrite ^/AAA/.*$ /a/c/f last; }
>
> location / { uwsgi|scgi|fcgi handler section }
>
>
>> On the other hand, if I remove the rewrite from nginx server directive,
>> and I leave both routes_in and routes_out as described before in
>> /app/routes.py, it works but randomly.
>>
>> Once every two or three times I refresh the page, I get:
>>
>> "invalid request"
>>
>>
>>
>>
>> On Mon, Feb 2, 2015 at 7:50 PM, Michele Comitini <michele....@gmail.com>
>> wrote:
>>
>>> you still need your routes.py in place:
>>>
>>> routes_out = (
>>>     ('/app/ctr/fnc', r'/AAA'),
>>>
>>> )
>>>
>>>
>>> 2015-02-02 11:23 GMT+01:00 al ex <a22...@gmail.com>:
>>>
>>>> I have setup this route in /web2py/applications/app
>>>>
>>>> routes_in = (
>>>>     (r'/AAA/?', '/app/ctr/fnc'),
>>>> )
>>>>
>>>> routes_out = (
>>>>     ('/app/ctr/fnc', r'/AAA'),
>>>>
>>>> )
>>>>
>>>>
>>>> With rockets, on localhost, it works fine.
>>>>
>>>> On production server nginx 1.7.9, uwsgi 2.0.8, python 2.7.6, if I
>>>> repeatedly refresh /AAA, sometimes it work, sometimes it gives: "invalid
>>>> request".
>>>>
>>>> This goes apparently randomly.
>>>>
>>>> How to isolate and solve this problem?
>>>> I thought maybe trying to eliminate routes.py, and mimic the same rules
>>>> on nginx, could give me a hint.
>>>>
>>>> routes_in would go to
>>>>
>>>> location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc
>>>> break ; }
>>>>
>>>> but how to write route_out in this case?
>>>>
>>>>
>>>>  --
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)
>>>> - http://github.com/web2py/web2py (Source code)
>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to web2py+un...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to