Question about install support for python and php together
Phillip Oldham
phill at activityhq.com
Fri May 7 12:28:28 MSD 2010
On 06/05/2010 04:17, sagasw wrote:
> I get a vps host and install php already with spawn-fcgi.
> And you could see my steps here:
> http://sunxiunan.com/?p=1618
>
> Now I want to add support python (web.py) in this host,
> http://webpy.org/cookbook/fastcgi-nginx
> and try the steps in web.py, but can't work correct.
> just get
> spawn-fcgi: child exited with: 2
>
> Who could tell me the steps I should do?
I've personally had nothing but problems with spawn-fcgi and stopped
using it years ago. The -b switch for the php-cgi config tells PHP to
bind to an address:port, so you don't really need spawn-fcgi as long as
something can keep an eye on the process.
We use supervisord to spawn & manage both PHP & Python services which
sit behind nginx. A supervisor config with something like the following
should get you going:
[program:PHP]
command=/usr/bin/php-cgi -c /etc/php.ini -b 8888
autostart=true
environment=PHP_FCGI_MAX_REQUESTS=100,PHP_FCGI_CHILDREN=3
[program:MyPythonProgram]
directory=/path/to/my/py/app/dir
command=/usr/bin/python mywsgiapp.py
Then in your nginx config simply create a config file for each FCGI
environment (php/python) and add any "backends" (for python,
specifically) to your vhosts.
You can even use supervisord to start/manage your nginx instance. We
have supervisord manage everything, and have monit keeping an eye on
supervisord as an added bonus.
You can see more on supervisord at http://supervisord.org, however the
site is going through a server move at the moment so they've only got
the manual up at the moment.
--
*Phillip B Oldham*
ActivityHQ
phill at activityhq.com <mailto:phill at theactivitypeople.co.uk>
------------------------------------------------------------------------
*Policies*
This e-mail and its attachments are intended for the above named
recipient(s) only and may be confidential. If they have come to you in
error, please reply to this e-mail and highlight the error. No action
should be taken regarding content, nor must you copy or show them to anyone.
This e-mail has been created in the knowledge that Internet e-mail is
not a 100% secure communications medium, and we have taken steps to
ensure that this e-mail and attachments are free from any virus. We must
advise that in keeping with good computing practice the recipient should
ensure they are completely virus free, and that you understand and
observe the lack of security when e-mailing us.
------------------------------------------------------------------------
More information about the nginx
mailing list