before proceeding I created a custom running application from webfaction
panel,
then pointed my domain to this application

*[ nginx install ]*

wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar xvxf nginx-0.8.54.tar.gz
cd nginx-0.8.54
./configure \
  --prefix=/home/myuseronwebfaction/nginx \
  --sbin-path=/home/myuseronwebfaction/nginx/sbin/nginx \
  --conf-path=/home/myuseronwebfaction/nginx/nginx.conf \
  --error-log-path=/home/myuseronwebfaction/nginx/log/nginx/error.log \
  --pid-path=/home/myuseronwebfaction/nginx/run/nginx/nginx.pid  \
  --lock-path=/home/myuseronwebfaction/nginx/lock/nginx.lock \
  --with-http_ssl_module \
  --with-http_flv_module \
  --with-http_gzip_static_module \
  --http-log-path=/home/myuseronwebfaction/nginx/log/nginx/access.log \
  --http-client-body-temp-path=/home/myuseronwebfaction/nginx/tmp/nginx/client/
\
  --http-proxy-temp-path=/home/myuseronwebfaction/nginx/tmp/nginx/proxy/ \
  --http-fastcgi-temp-path=/home/myuseronwebfaction/nginx/tmp/nginx/fcgi/

*[ nginx.conf ]*

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    access_log  /home/myuseronwebfaction/logs/user/access_appname.log
 combined;
    error_log   /home/myuseronwebfaction/logs/user/error_appname.log   crit;

    include         mime.types;
    sendfile        on;

    server {
listen #port_for_custom_running_application;
location / {
include uwsgi_params;
uwsgi_pass unix:///home/myuseronwebfaction/tmp/uwsgi.sock;
}
    }
}


*[ web2py ]*
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
python2.7 web2py.py #seems needed before using it

*[ uwsgi ]*
wget http://projects.unbit.it/downloads/uwsgi-0.9.7.tar.gz
tar xvzf uwsgi-0.9.7.tar.gz
cd uwsgi-0.9.7
make -f Makefile.Py27
mv uwsgi /home/myuseronwebfaction/bin

*[ run commands ]*
nginx
uwsgi -s /home/myuseronwebfaction/tmp/uwsgi.sock --pythonpath
/home/myuseronwebfaction/web2py --module wsgihandler -d
/home/myuseronwebfaction/tmp/uwsgi.log -t 20 --async 256 --limit-as 64 -m -r
--no-orphans

uwsgi params explained http://projects.unbit.it/uwsgi/wiki/Doc

important params
-d /home/myuseronwebfaction/tmp/uwsgi.log    #daemon mode
--async 256   #async instead of processes or threads, similar to greenlets
--limit-as 64  #max memory allowed to consume in Mb

now it consumes less than 25 Mb

Reply via email to