I kinda gave up on nginx.  It (or uwsgi) gave me an error when I ran a
long-running controller.  Some kind of time-out limit must be set
somewhere, but I couldn't figure where it is.  Not much documentation
out there.  So I went back to Apache, which takes more RAM, but seems
stable.


On Apr 17, 9:33 am, "Mr. Electronic" <[email protected]> wrote:
> Hi
>
> I have tried to create a simple installation script for Web2py on
> Ubuntu/Nginx/uWSGI.
>
> It is not complete but will give a good start for someone that has
> never tried Nginx and Web2py.
>
> It should be used on a fresh Ubuntu 10.04 (LTS) minimal installation.
> It is using Launchpad.net
>
> Br.
> Rune Christensen
>
> #!/bin/bash
>
> #Ubuntu 10.04 (LTS) + Nginx + uWSGI + Web2py
>
> # Get Web2py Admin Password
> echo -e "Web2py Admin Password: \c "
> read  PW
>
> # Upgrade and install needed software
> apt-get update
> apt-get -y upgrade
>
> apt-get install python-software-properties
>
> add-apt-repository ppa:nginx/stable
> add-apt-repository  ppa:uwsgi/release
>
> apt-get update
>
> apt-get -y install nginx-full
> apt-get -y install uwsgi-python
>
> # Create configuration file /etc/nginx/sites-available/web2py
> echo 'server {
>         listen          80;
>         server_name     $hostname;
>
>         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;
>
>         location / {
>                 uwsgi_pass      127.0.0.1:9001;
>                 include         uwsgi_params;
>                 uwsgi_param     UWSGI_SCHEME $scheme;
>         }}' >/etc/nginx/sites-available/web2py
>
> ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/
> web2py
>
> rm /etc/nginx/sites-enabled/default
> rm /etc/nginx/sites-available/default
>
> mkdir /etc/nginx/ssl
> cd /etc/nginx/ssl
> openssl genrsa -out web2py.key 1024
> openssl req -batch -new -key web2py.key -out web2py.csr
> openssl x509 -req -days 1780 -in web2py.csr -signkey web2py.key -out
> web2py.crt
>
> # Create configuration file /etc/uwsgi-python/apps-available/
> web2py.xml
> echo '<uwsgi>
>     <socket>127.0.0.1:9001</socket>
>     <pythonpath>/var/web2py/</pythonpath>
>     <app mountpoint="/">
>         <script>wsgihandler</script>
>     </app>
> </uwsgi>' >/etc/uwsgi-python/apps-available/web2py.xml
> ln -s /etc/uwsgi-python/apps-available/web2py.xml /etc/uwsgi-python/
> apps-enabled/web2py.xml
>
> # Install Web2py
> apt-get -y install unzip
> cd /var/
> wgethttp://web2py.com/examples/static/web2py_src.zip
> unzip web2py_src.zip
> rm web2py_src.zip
> chown -R www-data:www-data web2py
> cd /var/web2py
> sudo -u www-data python -c "from gluon.main import save_password;
> save_password('$PW',443)"
>
> /etc/init.d/uwsgi-python restart
> /etc/init.d/nginx restart

Reply via email to