PHP and Django: Nginx, FastCGI and Green Unicorn?

I am curious ... I am looking to have a really effective setting for my fragment for the client. I am not an expert with servers and therefore looking for good reliable resources to help me configure this ... I was recommended that using FastCGI for PHP, Green Unicorn (gunicorn) for Django and Nginx for media is good for PHP and Django to run on same segment / server. This is necessary because you have the main Django site and administrator, but also for the PHP forum.

Can someone push me to some useful resources that will help me tweak this on my snippet? Or at least any opinions or comments on this particular setting?

+4
source share
4 answers

I think one solution can use a combination of PHP as an apache module or through FastCGI and use the apache mod_proxy module to do some kind of reverse proxy to access your gunicorn administration application

You may have a setting such as:

  • Front Apache HTTP Server on port 80: www.host.com:80
  • Backend gunicorn HTTP server on another port: other.host.com:8080 or localhost: 8080 with open access using mod_proxy and url, for example www.host.com/admin/
  • Media HTTP Server: media.host.com, if it must be on the same system, you can use mod_proxy and start the NGINX server on a different TCP port.

Please note that you will not be able to get better performance with NGINX as a media server hidden behind apache with mod_proxy.

This part of the configuration is based on the ability to have more than one public IP address on this snippet.

+2
source

I found this question and almost went the way of using the greenest unicorn. Just a note that uWSGI seems to give significantly better performance than Green Unicorn, see a set of criteria here .

Linode has a great way to configure UWSGI from Nginx to Ubuntu (it also works fine on Debian).

Now I use this setting and am very pleased with it.

+1
source

For the PHP part, consider installing any PHP accelerator, such as eAccelerator or any other byte byte.
This is a more general article, but may also be of interest to you. For the Django part, I have no idea / experience.

-1
source

I am trying to run django for nginx with a WSGI module . It works fine and pretty fast. You will have to compile your own nginx, but it is really painless.

-1
source

Source: https://habr.com/ru/post/1304756/


All Articles