I am working again. Sorry that little help was forthcoming.
Here is the revised uwsgi configuration file. The changed lines are
bolded. I suspect that it is the second change that made the difference.
Interesting that this was not previously needed. I did upgrade from uwsgi
v (very old!) to uwsgi 2.x. Perhaps that changed along the way:
<uwsgi>
<plugin>python</plugin>
<socket>/run/uwsgi/app/web2py/web2py.socket</socket>
*<chdir>/var/web2py/</chdir>*
<pythonpath>/var/web2py/</pythonpath>
<app mountpoint="/">
<script>wsgihandler*:application*</script>
</app>
<master/>
<processes>4</processes>
<harakiri>60</harakiri>
<reload-mercy>8</reload-mercy>
<cpu-affinity>1</cpu-affinity>
<stats>/tmp/stats.socket</stats>
<max-requests>2000</max-requests>
<limit-as>512</limit-as>
<reload-on-as>256</reload-on-as>
<reload-on-rss>192</reload-on-rss>
<no-orphans/>
<vacuum/>
</uwsgi>
I am not using emperor mode as the site has only a single app used for test
purposes. My config matches suggestions made by Bruce Wade several years
ago on this forum. (Thanks to Bruce.)
On Saturday, May 30, 2015 at 12:01:48 PM UTC-7, Lewis wrote:
>
> For 3+ years, everything worked. Linode + nginx + uwsgi + web2py. Took
> weeks of effort to config because of the poor articulation between the
> layers and the profusion of slightly incompatible approaches to config.
>
> Today, I upgraded ubuntu from 12.04 to 12.8. That seemed to work. I
> stopped uwsgi (should have been stopped by the reinstall) and nginx. I
> started both services.
>
> Went to the site: "Internal Server Error"
>
> Whose message is this: nginx, uwsgi, web2py? No way to know. Great
> diagnostics.
>
> So, how can I further diagnose this?
>
> Is there any obvious problem that you can suggest I fix?
>
> Below are some clues: 1. Processes running; 2. nginx config file; 3.
> uwsgi config file; 4. web2py wsgi handler
>
> Thanks for any help you can offer about how to debug this.
>
> 1. Subset of processes running:
>
> www-data 5153 1 0 18:08 ? 00:00:00 /usr/bin/uwsgi --ini /usr/share/
> www-data 5161 5153 0 18:08 ? 00:00:00 /usr/bin/uwsgi --ini /usr/share/
> www-data 5163 5153 0 18:08 ? 00:00:00 /usr/bin/uwsgi --ini /usr/share/
> www-data 5164 5153 0 18:08 ? 00:00:00 /usr/bin/uwsgi --ini /usr/share/
> www-data 5165 5153 0 18:08 ? 00:00:00 /usr/bin/uwsgi --ini /usr/share/
> root 5210 2 0 18:13 ? 00:00:00 [kworker/0:0]
> root 5287 2799 0 18:15 ? 00:00:00 sshd: root@pts/0
> root 5306 5287 0 18:15 pts/0 00:00:00 -bash
> root 5368 1 0 18:16 ? 00:00:00 nginx: master process /usr/sbin/
> www-data 5369 5368 0 18:16 ? 00:00:00 nginx: worker process
> www-data 5370 5368 0 18:16 ? 00:00:00 nginx: worker process
> www-data 5371 5368 0 18:16 ? 00:00:00 nginx: worker process
> www-data 5372 5368 0 18:16 ? 00:00:00 nginx: worker process
>
>
>
> 2. nginx config file in sites-enabled, called web2py:
>
>
> server {
> listen 80;
> server_name $hostname;
> location ~* /(\w+)/static/ {
> root /var/web2py/applications/;
> }
> location / {
> #uwsgi_pass 127.0.0.1:9001;
> uwsgi_pass unix:///run/uwsgi/app/web2py/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
> }
> }
>
> server {
> listen 443;
> server_name $hostname;
> ssl on;
> ssl_certificate /etc/nginx/ssl/web2py.crt;
> ssl_certificate_key /etc/nginx/ssl/web2py.key;
> location / {
> #uwsgi_pass 127.0.0.1:9001;
> uwsgi_pass unix:///run/uwsgi/app/web2py/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
> }
>
> }
>
>
>
> 3.uwsgi config file called web2py.xml in apps-enabled:
>
> <uwsgi>
> <plugin>python</plugin>
> <socket>/run/uwsgi/app/web2py/web2py.socket</socket>
> <pythonpath>/var/web2py/</pythonpath>
> <app mountpoint="/">
> <script>wsgihandler</script>
> </app>
> <master/>
> <processes>4</processes>
> <harakiri>60</harakiri>
> <reload-mercy>8</reload-mercy>
> <cpu-affinity>1</cpu-affinity>
> <stats>/tmp/stats.socket</stats>
> <max-requests>2000</max-requests>
> <limit-as>512</limit-as>
> <reload-on-as>256</reload-on-as>
> <reload-on-rss>192</reload-on-rss>
> <no-orphans/>
> <vacuum/>
> </uwsgi>
>
>
>
>
> 4. web2py wsgi handler:
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
>
> """
> This file is part of the web2py Web Framework
> Copyrighted by Massimo Di Pierro <[email protected]>
> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
>
>
>
>
> This is a WSGI handler for Apache
> Requires apache+mod_wsgi.
>
>
> In httpd.conf put something like:
>
>
> LoadModule wsgi_module modules/mod_wsgi.so
> WSGIScriptAlias / /path/to/wsgihandler.py
>
>
> """
>
>
> # change these parameters as required
> LOGGING = False
> SOFTCRON = False
>
>
> import sys
> import os
>
>
> path = os.path.dirname(os.path.abspath(__file__))
> os.chdir(path)
>
>
> if not os.path.isdir('applications'):
> raise RuntimeError('Running from the wrong folder')
>
>
> sys.path = [path] + [p for p in sys.path if not p == path]
>
>
> sys.stdout = sys
> ...
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.