Pylons 0.9.7-dev Nginx Deployment on a Two-Way Routed Xen Setup ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ :Posted: 2007-11-10 01:23 :Tags: Pylons, Debian, Virtulization On Dom0 set up port forwarding from port 80 to the DomU running NginX, in this case 10.0.0.1:: sudo -i iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 80 -j DNAT --to 10.0.0.1:80 exit These get lost on each reboot unless you put them into a script in ``/etc/network/if-up.d/iptables`` but that's OK for the moment. First install Nginx:: sudo apt-get install nginx If you visit the URL of the Dom0 server you should see the ``Welcome to nginx!`` message served from Nginx on the DomU. Next you need to setup Python and Pylons. Install python:: sudo apt-get install python mercurial Get vitualenv:: wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-0.9.1.tar.gz tar zxfv virtualenv-0.9.1.tar.gz cp virtualenv-0.9.1/virtualenv.py ./ rm virtualenv-0.9.1.tar.gz rm -r virtualenv-0.9.1 Decide where you want your Pylons applications. I like mine in ``/var/web`` so lets create a test project:: sudo mkdir /var/web sudo mkdir /var/web/test sudo chown james:james /var/web/test Setup a virtual environment:: james@vm2:~$ python virtualenv.py /var/web/test New python executable in /var/web/test/bin/python Installing setuptools.............................done. james@vm2:~$ cd /var/web/test Now you can install Pylons:: mkdir dep cd dep hg clone http://pylonshq.com/hg/pylons-dev cd pylons-dev ../../bin/python setup.py develop Now create a project:: mkdir src cd src ../bin/paster create -t pylons Test Now edit ``Test/test/config/middleware.py`` and set ``use_webop=True``. Serve the app with:: cd Test/ ../../bin/python setup.py develop ../../bin/easy_install sqlalchemy <-- So that beaker doesn't break ../../bin/paster serve --reload development.ini That's it. Now you just need to setup Nginx to reverse proxy to the paste server running on port 5000. Edit the ``/etc/nginx/nginx.conf`` file so that the ``location /`` part looks like this:: location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; proxy_pass http://127.0.0.1:5000; proxy_redirect default; } You'll then need to restart nginx and the paster server:: sudo /etc/init.d/nginx restart ../../bin/paster serve --reload development If you press refresh in your browser you should see the Pylons welcome page. Comments ======== Segtext.Com » Pylons 0.9.7-dev Ngenix Deployment on a Two-Way Routed Xen Setup --------------------------------------------------------------------------------------- :Posted: 2007-11-10 08:19 [...] Hyde wrote an interesting post today on Pylons 0.9.7-dev Ngenix Deployment on a Two-Way Routed Xen SetupHere’s a quick [...] :URL: http://www.segtext.com/?p=659 Crashlab ----------- :Posted: 2008-01-12 02:02 Hi... Good tutorial. I hope that also mine posted here: http://www.smokinglinux.com/vmware-server-virtualization/install-vmware-server-on-debian-etch-in-an-hetzner-rootserver that speaks about installation of vmware with a bridged solution in an Hetzner RootServer is good for you. ;) :URL: http://www.smokinglinux.com