Setup Script: Ubuntu + Nginx + uWSGI

747 views
Skip to first unread message

pbreit

unread,
Mar 27, 2011, 3:29:43 PM3/27/11
to web...@googlegroups.com
I did a little more work on a setup script for Ubuntu + Nginx + uWSGI. Please let me know if you experience any problems or have any suggestions. I'm fairly new to this.

+ Tested on Ubuntu 10.04 (Rackspace Cloud)
+ Nginx 0.8.54
+ SSL (self-signed)
+ uWSGI 0.9.7.1
+ Postgres 8.4
+ Web2py Current
+ user=www-data

$ chmod +x setup-ubuntu-nginx.sh
$ sudo ./setup-ubuntu-nginx.sh

Note: the script runs almsot unattended. The only user input required is specifying web2py admin password.

Anthony

unread,
Mar 27, 2011, 3:37:03 PM3/27/11
to web...@googlegroups.com
Once this has been tested/refined, it might be a nice addition to the /web2py/scripts folder.

Massimo Di Pierro

unread,
Mar 27, 2011, 3:53:05 PM3/27/11
to web2py-users
Let me know when you think this is a ready for inclusion. I agree with
Anthony, it would be a valuable addition to scrips/

On Mar 27, 2:29 pm, pbreit <pbreitenb...@gmail.com> wrote:
> I did a little more work on a setup script for Ubuntu + Nginx + uWSGI.
> Please let me know if you experience any problems or have any suggestions.
> I'm fairly new to this.
>
> + Tested on Ubuntu 10.04 (Rackspace Cloud)
> + Nginx 0.8.54
> + SSL (self-signed)
> + uWSGI 0.9.7.1
> + Postgres 8.4
> + Web2py Current
> + user=www-data
> + Hosted at BitBucket:https://bitbucket.org/pbreit/web2py-automation/src/
>
> $
> wgethttp://bitbucket.org/pbreit/web2py-automation/raw/tip/setup-ubuntu-ng...

LightOfMooN

unread,
Mar 27, 2011, 4:24:24 PM3/27/11
to web2py-users
It needs something like
client_max_body_size 100M;
in nginx.conf to avoid error: 413 Request Entity Too Large
(for example, try to install app with > 6mb or upload big file)

On 28 мар, 01:53, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:

pbreit

unread,
Mar 28, 2011, 3:03:56 AM3/28/11
to web...@googlegroups.com, LightOfMooN
Updated.
client_max_body_size 10m; (worried about making it higher since opens up easy DOS attack)
+ prompt for admin password at beginning

VP

unread,
Mar 28, 2011, 9:21:39 AM3/28/11
to web2py-users
Can you make it a little more general by having two variables; one for
the location of web2py installation, and the other for the user
running web2py, nginx and uwsgi. The default values can be /var/opt
and www-data, but sometimes other things are preferable.

Marco Tulio

unread,
Mar 16, 2012, 11:37:09 PM3/16/12
to web...@googlegroups.com
Hi,

Tested on:

Ubuntu 10.04.4 LTS
nginx-1.0.11
uwsgi-0.9.9.3
web2py 1.99.7
user=www-data
Hosted at Amazon EC2.

ubuntu@IP:/opt$ uname -a
Linux IP 2.6.32-342-ec2 #43-Ubuntu SMP Wed Jan 4 18:22:42 UTC 2012 x86_64 GNU/Linux


Pretty much downloaded the script and ran it. Installed nginx, uwsgi, web2py and ran it perfectly.
BUT, I can't create applications.
It says "Failure to create application" or "Unable to create application '<application name>' (it may exist already)".

I read somewhere that if you call python2.6 web2py and then calling nginx, it may solve this, but they didn't explain and I couldn't make it work.

last stable release of uwsgi is http://projects.unbit.it/downloads/uwsgi-1.0.4.tar.gz
last stable release of nginx is 1.0.14

Also noticed that Web2py itself fails to recognize Nginx and it's version (as it does with Apache at the admin page).
It says "Running on None"


ubuntu@IP:/opt$ ls
init-deb.sh  nginx-1.0.11         uwsgi                 web2py
nginx        nginx-1.0.11.tar.gz  uwsgi-0.9.9.3.tar.gz  web2py_src.zip

ubuntu@IP:/opt$ ps ax | grep nginx
29006 ?        Ss     0:00 nginx: master process /opt/nginx/sbin/nginx
29007 ?        S      0:00 nginx: worker process
29008 ?        S      0:00 nginx: worker process
29009 ?        S      0:00 nginx: worker process
29010 ?        S      0:00 nginx: worker process
29093 pts/0    S+     0:00 grep --color=auto nginx

ubuntu@IP :/opt$ ps ax | grep uwsgi
28991 ?        S      0:00 /usr/local/bin/uwsgi -s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pythonpath /opt/web2py/ --module wsgihandler
29000 ?        S      0:00 /usr/local/bin/uwsgi -s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pythonpath /opt/web2py/ --module wsgihandler
29001 ?        S      0:00 /usr/local/bin/uwsgi -s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pythonpath /opt/web2py/ --module wsgihandler
29002 ?        S      0:00 /usr/local/bin/uwsgi -s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pythonpath /opt/web2py/ --module wsgihandler
29003 ?        S      0:00 /usr/local/bin/uwsgi -s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pythonpath /opt/web2py/ --module wsgihandler
29096 pts/0    S+     0:00 grep --color=auto uwsgi

Nginx sounds really promissing, it could be really nice if this would work perfectly.

Thanks in advanced for any help.

Just one question: why you compiled everything when you could have used the debian packages??
It doesn't work with deb? Why?

Thanks again!

Bruce Wade

unread,
Mar 16, 2012, 11:49:49 PM3/16/12
to web...@googlegroups.com
Probably because the debian packages tend to be out of date, it is always better to use the latest versions of these packages.
--
--
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com

pbreit

unread,
Mar 17, 2012, 4:31:13 AM3/17/12
to web...@googlegroups.com
Hard to say. Here's another script you could try:

You could either run it as-is, update the versions and run or step through each command manually.

Jim S

unread,
Nov 4, 2013, 5:25:22 PM11/4/13
to web...@googlegroups.com
Just ran today on fresh Ubuntu 13.10 and am getting:

Internal Error
Ticket issued:  unrecoverable

When clicking on my personal app.  Welcome/Admin and Examples work just fine.

Where would I begin trouble-shooting?

-Jim

Richard Vézina

unread,
Nov 4, 2013, 9:04:32 PM11/4/13
to web2py-users
sudo chown -R www-data.www-data web2py/

Richard


--
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/groups/opt_out.

Jim S

unread,
Nov 5, 2013, 8:40:27 AM11/5/13
to web...@googlegroups.com
Perfect!  

Thanks a bunch.

-Jim

Niphlod

unread,
Nov 5, 2013, 2:50:13 PM11/5/13
to web...@googlegroups.com

Jim S

unread,
Nov 5, 2013, 5:03:16 PM11/5/13
to web...@googlegroups.com
Yes, but I added another application in my applications directory the install.  So, I had to run this again.

-Jim
Reply all
Reply to author
Forward
0 new messages