views:

461

answers:

4

I'm curious... I'm looking to have a really efficient setup for my slice for a client. I'm not an expert with servers and so am looking for good solid resources to help me set this up... It's been recommended to me that using FastCGI for PHP, Green Unicorn (gunicorn) for Django and Nginx for media is a good combination to have PHP and Django running on the same slice/server. This is needed due to have a main Django website and admin, but also to have a PHP forum on there too.

Could anyone push me to some useful resources that would help me set this up on my slice? Or at least, any views or comments on this particular setup?

A: 

For the PHP part consider to install any PHP accelerator like eAccelerator or any other bytecode cache.
This is a more general article but could also be interessting for you.
For the Django part I have no idea / experience.

Hippo
aa bytecode cache for PHP is not a solution for his question, he wants to have php and django working on the same host.
Benoit
To quote the question: "I'm looking to have a really efficient setup..." therefore I would install a bytecode cache... ;-)
Hippo
+1  A: 

I think one solution could be using a combination of PHP as apache module or throught FastCGI and use mod_proxy apache module to do some reverse proxy to access your administration app running with gunicorn

You can have a setup like :

  • Front HTTP Server apache on port 80 : www.host.com:80
  • Backend HTTP Server gunicorn on other port : other.host.com:8080 or localhost:8080 publicly accessed with mod_proxy and url like www.host.com/admin/
  • Media HTTP Server : media.host.com, if it has to be on same system you can use mod_proxy and run NGINX server on another TCP port.

Note that you should not be able to get most performance with the NGINX as media server hidden behind apache with mod_proxy.

This part of setup relies upon the possibility of having more than one public IP adress on this slice.

Benoit
A: 

Nah you don't wanna be doing that mate. What you wanna be doing is running Green Unicorn behind a mod_proxy setup with a whiskey interface.

Dan
A: 

I've been trying to run django behind nginx with WSGI module. It runs OK and pretty fast. You'll have to compile your own nginx, but it's really painless.

ArBaDaCarBa
The problem here is that the nginx wsgi module is quite different than the apache one. Specifically, nginx is a single process server, so if the wsgi app blocks then the whole server blocks with it. It is unsupported. If you google for Graham Dumpleton, his comments are instructive as to the problems with this setup. To save time I have done so:http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.html This is why this answer neither is best practices, nor answers the question.
chiggsy