Saw the slice from Bruce. I was already there. I have spent some 14 hours on this. I have read the docs on many of the uwsgi options. I have looked more carefully at the nginx docs. I now get some diagnostics that tell me much more about what is going on. Along the way I have learned to hand-author init scripts (somewhat).
Here is what I found out and have done. 1. I believe that cherokee may have installed uwsgi itself or maybe not. But, I believe I had more than one version of uwsgi installed and criss-crossing symlinks. Plus, the version that apt-get retrieves for ubuntu 11.10 is ancient. 2. I completed removed old installs of uwsgi. 3. I installed uwsgi 1.2.3 directly from unbit.it using pip. Unfortunately, this only builds the binary. You get no config and no init script. But, you do get a clean up-to-date binary. That is something. 4. Looking at a clean nginx init and several examples of uwsgi init's, I created one. It evolved and I believe it works. 5. I created a more complete web2py.xml file for uwsgi. There is a lot of conflicting information flloating around about this that is quite out of date (Bruce Wade got a bit of it more up to date). 6. I cleaned up my nginx and made sure it served static files so at least I could be sure that nginx was basically working before I changed the virtual server definitions to enable uwsgi and web2py. (It did indeed serve "hello, world!") But, I still don't think I am that much closer to having this work. I no longer get 502 bad gateway. I get 504 gateway timeout. Here is my uwsgi log: *** Starting uWSGI 1.2.3 (32bit) on [Fri May 18 09:27:27 2012] *** > compiled with version: 4.6.1 on 17 May 2012 23:33:21 > detected number of CPU cores: 4 > current working directory: / > writing pidfile to /var/run/uwsgi.pid > detected binary path: /usr/local/bin/uwsgi > uWSGI running as root, you can use --uid/--gid/--chroot options > setgid() to 33 > setuid() to 33 > your memory page size is 4096 bytes > detected max file descriptor number: 1024 > lock engine: pthread robust mutexes > uwsgi socket 0 bound to TCP address 127.0.0.1:9001 fd 3 > Python version: 2.7.2+ (default, Oct 4 2011, 20:29:37) [GCC 4.6.1] > *** Python threads support is disabled. You can enable it with > --enable-threads *** > Python main interpreter initialized at 0x9829bd8 > your server socket listen backlog is limited to 100 connections > *** Operational MODE: no-workers *** > added /var/web2py/ to pythonpath. > mounting /var/web2py/wsgihandler.py on / > WSGI app 0 (mountpoint='/') ready in 0 seconds on interpreter 0x9829bd8 > pid: 25731 (default app) > spawned uWSGI master process (pid: 25731) The fact that there are no workers is obviously wrong. I requested 4 processes. I sort of wonder about the working directory. But, I am launching uwsgi and python and pointing to wsgihandler.py. Here is the web2py.xml. It looks A LOT different from anything in the cookbook or slices: <uwsgi> > <uid>33</uid> > <gid>33</gid> > <pidfile>/var/run/uwsgi.pid</pidfile> > <pythonpath>/var/web2py/</pythonpath> > <daemonize>/var/log/uwsgi.log</daemonize> > <socket>127.0.0.1:9001</socket> > <processes>4</processes> > <master/> > <mount>/=/var/web2py/wsgihandler.py</mount> > <memory-report/> > </uwsgi> Here is the config for nginx (please ignore the port 443 setup--I just wanted to win one battle before moving on...): server { > listen 80; > server_name $hostname; > location ~* /(\w+)/static/ { > root /var/web2py/applications/; > } > location / { > uwsgi_pass 127.0.0.1:9001; > include uwsgi_params; > } > } > server { > listen 443; > server_name $hostname; > ssl on; > ssl_certificate /etc/nginx/ssl/web2py.crt; > ssl_certificate_key /etc/nginx/ssl/web2py.key; > } One more suspicious symptom is that when I look at running processes, I only see the one master for uwsgi: UID PID PPID C STIME TTY TIME CMD > root 1 0 0 Mar05 ? 00:00:09 /sbin/init > root 2 0 0 Mar05 ? 00:00:00 [kthreadd] > root 3 2 0 Mar05 ? 00:00:32 [ksoftirqd/0] > root 5 2 0 Mar05 ? 00:00:00 [kworker/u:0] > root 6 2 0 Mar05 ? 00:00:00 [migration/0] > root 7 2 0 Mar05 ? 00:00:00 [migration/1] > root 8 2 0 Mar05 ? 00:00:00 [kworker/1:0] > root 9 2 0 Mar05 ? 00:00:40 [ksoftirqd/1] > root 10 2 0 Mar05 ? 00:00:00 [migration/2] > root 11 2 0 Mar05 ? 00:00:00 [kworker/2:0] > root 12 2 0 Mar05 ? 00:00:31 [ksoftirqd/2] > root 13 2 0 Mar05 ? 00:00:00 [migration/3] > root 14 2 0 Mar05 ? 00:00:00 [kworker/3:0] > root 15 2 0 Mar05 ? 00:00:40 [ksoftirqd/3] > root 16 2 0 Mar05 ? 00:00:00 [cpuset] > root 17 2 0 Mar05 ? 00:00:00 [khelper] > root 18 2 0 Mar05 ? 00:00:00 [kworker/u:1] > root 22 2 0 Mar05 ? 00:00:00 [xenwatch] > root 23 2 0 Mar05 ? 00:00:00 [xenbus] > root 149 2 0 Mar05 ? 00:00:18 [sync_supers] > root 151 2 0 Mar05 ? 00:00:00 [bdi-default] > root 153 2 0 Mar05 ? 00:00:00 [kblockd] > root 163 2 0 Mar05 ? 00:00:00 [md] > root 247 2 0 Mar05 ? 00:00:00 [rpciod] > root 248 2 0 Mar05 ? 00:02:37 [kworker/2:1] > root 280 2 0 Mar05 ? 00:00:01 [kswapd0] > root 281 2 0 Mar05 ? 00:00:00 [ksmd] > root 282 2 0 Mar05 ? 00:00:00 [fsnotify_mark] > root 286 2 0 Mar05 ? 00:00:00 [ecryptfs-kthrea] > root 288 2 0 Mar05 ? 00:00:00 [nfsiod] > root 291 2 0 Mar05 ? 00:00:00 [jfsIO] > root 292 2 0 Mar05 ? 00:00:00 [jfsCommit] > root 293 2 0 Mar05 ? 00:00:00 [jfsCommit] > root 294 2 0 Mar05 ? 00:00:00 [jfsCommit] > root 295 2 0 Mar05 ? 00:00:00 [jfsCommit] > root 296 2 0 Mar05 ? 00:00:00 [jfsSync] > root 297 2 0 Mar05 ? 00:00:00 [xfs_mru_cache] > root 298 2 0 Mar05 ? 00:00:00 [xfslogd] > root 299 2 0 Mar05 ? 00:00:00 [xfsdatad] > root 300 2 0 Mar05 ? 00:00:00 [xfsconvertd] > root 301 2 0 Mar05 ? 00:00:00 [glock_workqueue] > root 302 2 0 Mar05 ? 00:00:00 [delete_workqueu] > root 303 2 0 Mar05 ? 00:00:00 [gfs_recovery] > root 304 2 0 Mar05 ? 00:00:00 [crypto] > root 866 2 0 Mar05 ? 00:00:00 [khvcd] > root 968 2 0 Mar05 ? 00:01:43 [kworker/0:1] > root 981 2 0 Mar05 ? 00:00:00 [kpsmoused] > root 982 2 0 Mar05 ? 00:05:35 [kworker/1:1] > root 1009 2 0 Mar05 ? 00:01:37 [kjournald] > root 1038 1 0 Mar05 ? 00:00:00 upstart-udev-bridge > --daemon > root 1913 2 0 Mar05 ? 00:03:32 [kworker/3:1] > root 1933 1 0 Mar05 ? 00:00:00 upstart-socket-bridge > --daemon > root 1974 1 0 Mar05 ? 00:00:00 dhclient3 -e IF_METRIC=100 > -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases -1 > eth0 > root 1995 1 0 Mar05 ? 00:01:25 /usr/sbin/sshd -D > syslog 2029 1 0 Mar05 ? 00:10:58 rsyslogd -c5 > 102 2032 1 0 Mar05 ? 00:00:00 dbus-daemon --system > --fork --activation=upstart > daemon 2079 1 0 Mar05 ? 00:00:00 atd > root 2080 1 0 Mar05 ? 00:00:11 cron > root 2201 2 0 Mar05 ? 00:00:39 [flush-202:0] > root 2268 1 0 Mar05 hvc0 00:00:00 /sbin/getty -8 38400 hvc0 > ntp 2318 1 0 Mar05 ? 00:06:18 /usr/sbin/ntpd -p > /var/run/ntpd.pid -g -u 105:110 > root 17087 2 0 Apr07 ? 00:00:54 [kworker/0:2] > root 22656 1995 0 05:11 ? 00:00:01 sshd: root@pts/0 > root 22671 22656 0 05:11 pts/0 00:00:00 -bash > root 23855 1995 0 06:55 ? 00:00:00 sshd: root@notty > root 23870 23855 0 06:55 ? 00:00:00 > /usr/lib/openssh/sftp-server > www-data 25731 1 0 09:27 ? 00:00:00 /usr/local/bin/uwsgi -x > /etc/uwsgi/uwsgi-conf.xml -p /var/run/uwsgi.pid > root 25752 1 0 09:28 ? 00:00:00 nginx: master process > /usr/sbin/nginx > www-data 25753 25752 0 09:28 ? 00:00:00 nginx: worker process > www-data 25754 25752 0 09:28 ? 00:00:00 nginx: worker process > www-data 25755 25752 0 09:28 ? 00:00:00 nginx: worker process > www-data 25756 25752 0 09:28 ? 00:00:00 nginx: worker process > root 26018 22671 0 09:59 pts/0 00:00:00 ps -ef > postgres 29498 1 0 May16 ? 00:00:18 > /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c > config_file=/etc/postgresql/9.1/main/postgresql.conf > postgres 29500 29498 0 May16 ? 00:00:19 postgres: writer process > > > postgres 29501 29498 0 May16 ? 00:00:18 postgres: wal writer > process > > postgres 29502 29498 0 May16 ? 00:00:15 postgres: autovacuum > launcher process > > postgres 29503 29498 0 May16 ? 00:00:26 postgres: stats collector > process > > mysql 29796 1 0 May16 ? 00:00:25 /usr/sbin/mysqld > root 29855 1 0 May16 ? 00:00:00 udevd --daemon That's the news from Lake Woebegone. On the surface, nginx looks much easier to set up than apache. But, uwsgi seems much more difficult than mod_wsgi. Thanks for everyone's help.