Skip to content

Instantly share code, notes, and snippets.

@indexofire
Forked from wynemo/nginx.conf
Created April 30, 2012 14:32
Show Gist options
  • Select an option

  • Save indexofire/2558817 to your computer and use it in GitHub Desktop.

Select an option

Save indexofire/2558817 to your computer and use it in GitHub Desktop.

####install pip and virtualenv

$ sudo aptitude install python-setuptools python-pip
$ sudo pip install virtualenv

#easy_install
#easy_install pip
#pip install everything
#sudo pip install web.py

####compile uwsgi

$ sudo aptitude install python26-dev gcc
$ wget http://projects.unbit.it/downloads/uwsgi-1.1.2.tar.gz
$ tar zxvf uwsgi-1.1.2.tar.gz
$ python uwsgiconfig.py --build

####virtualenv and uwsgi stuff

$ cd webpy_project_dir
$ virtualenv --no-site-packages env
$ virtualenv --relocatable env
$ . env/bin/activate
$ mkdir env/src
$ wget http://webpy.org/static/web.py-0.36.tar.gz
$ tar zxvf web.py-0.36.tar.gz
$ python setup.py install
$ vim webpy_uwsgi.xml
$ cat webpy_uwsgi.xml

<uwsgi>
  <socket>127.0.0.1:9090</socket>
  <master/>
  <processes>2</processes>
  <max-requests>1000</max-requests>
</uwsgi>

$ ~/uwsgi-1.1.2/uwsgi --uid user -x ~/webpy_uwsgi.xml --vhost

####nginx conf $ sudo aptitude install nginx server { listen 80; server_name -; location / { include uwsgi_params; uwsgi_pass 127.0.0.1:9090; uwsgi_param UWSGI_PYHOME /home/user/webpy_project_dir/env; uwsgi_param UWSGI_SCRIPT wsgi; uwsgi_param UWSGI_CHDIR /home/user/webpy_project_dir/; }

}


$/etc/init.d/nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment