OK, here's another try. This is just a shell script which I have verified 
works on a clean Ubuntu 10.04 install. This script needs no additional 
editing. To get it to work with the script provided by Linode, everything is 
owned be the user "uwsgi". Besides the script, the only other place where 
the user is specified is in the uwsgi init.d script. Still working on SSL 
but that shouldn't be too hard. Sorry if I have wasted anyone's time. I have 
certainly wasted a lot of my own!

SSH in as root:
root$ vi setup.sh (paste the script below and save)
root$ chmod +x setup.sh
root$ sudo ./setup.sh

=== setup.sh ===
#!/bin/bash

apt-get update
apt-get -y upgrade
apt-get -y install build-essential psmisc python-dev libxml2 libxml2-dev 
python-setuptools
adduser --system --no-create-home --disabled-login --disabled-password 
--group uwsgi

apt-get -y install unzip
cd /opt/
wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
chown -R uwsgi:uwsgi web2py
cd web2py
sudo -u uwsgi python -c "from gluon.widget import console; console();"
sudo -u uwsgi python -c "from gluon.main import save_password; 
save_password(raw_input('admin password: '),443)"

cd /opt/
wget http://projects.unbit.it/downloads/uwsgi-0.9.6.8.tar.gz
tar -zxvf uwsgi*
mv uwsgi*/ uwsgi/
cd uwsgi/
python setup.py install
chown -R uwsgi:uwsgi /opt/uwsgi
touch /var/log/uwsgi.log
chown uwsgi /var/log/uwsgi.log

apt-get -y install libpcre3-dev build-essential libssl-dev
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx-0.8.54.tar.gz
cd /opt/nginx-0.8.54/
./configure --prefix=/opt/nginx --user=nginx --group=nginx 
--with-http_ssl_module
make
make install
adduser --system --no-create-home --disabled-login --disabled-password 
--group nginx
cp /opt/uwsgi/nginx/uwsgi_params /opt/nginx/conf/uwsgi_params
wget 
https://library.linode.com/web-servers/nginx/installation/reference/init-deb.sh
mv init-deb.sh /etc/init.d/nginx
chmod +x /etc/init.d/nginx
/usr/sbin/update-rc.d -f nginx defaults
/etc/init.d/nginx start
cd /opt/
wget 
https://library.linode.com/web-servers/nginx/python-uwsgi/reference/init-deb.sh
mv /opt/init-deb.sh /etc/init.d/uwsgi
chmod +x /etc/init.d/uwsgi
echo 'PYTHONPATH=/opt/web2py/
MODULE=wsgihandler' > /etc/default/uwsgi
/usr/sbin/update-rc.d -f uwsgi defaults
/etc/init.d/uwsgi start

echo 'user uwsgi;
worker_processes  4;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    server {
        listen       80;
        server_name  "";

        location / {
            uwsgi_pass     127.0.0.1:9001;
            include        uwsgi_params;
        }
        
        location /static {
            root   /opt/web2py/applications/welcome/;
        }
    }
}' > /opt/nginx/conf/nginx.conf
/etc/init.d/nginx restart

Reply via email to