Comments on Installing Nginx With PHP5 And MySQL Support On Debian Squeeze

Installing Nginx With PHP5 And MySQL Support On Debian Squeeze Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows how you can install Nginx on a Debian Squeeze server with PHP5 support (through FastCGI) and MySQL support.

22 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: wilo

Why 

apt-get install lighttpd

and 

update-rc.d -f lighttpd remove

instead of

apt-get install spawn-fcgi

is there any reason?

By: GarfieldWTF

I think the author make this tutorial suitable to be use in Debian Lenny as well.

Coz during Debian Lenny time, there is no such package "spawn-fcgi".

The standalone "spawn-fcgi" is only added into the repo start from Squeeze

By: neoselen

there is another package wich is now a standalone working daemon:
php5-fdm.
So I can skip the lighttpd step :)

 Done on raspbian wheezy :)

By: Larsen

Very nice howto. Thx a lot!

Instead of restarting nginx I would simply reload it after having changed the config:

/etc/init.d/nginx reload

By: Anonymous

Looks like some competition who will make more articles for squeeze by CTRL+C , CTRL+V from LENNY tutorials.

  just apt-get install spawn-fcgi is all you need for  spawn-fcgi , no need to install lighttpd

with all dep.

By: Anonymous

Thank you so much !!

it worked and am very happy after trying too much tutorials with no way to get this working 

By: urza

Thanks for your useful article.

Just an integration: in location ~ \.php$ stanza, you should add the following directive:

root /var/www;

otherwise, the DOCUMENT_ROOT php variable is set to an obscure /usr/local/nginx/html, perhaps rooted in the source code :-).

 It is weird, since such directive it is already declared in the stanza above...

 

By: Edson Bassani

Hey Falko, I have no words to thank you for your tutorial. I was able to get my VPS up and running in less than 1 hour with LNMP thanks your very good and clear explanation. The unique thing I needed to was reboot the container because I had a 503 Bad Gateway, maybe because I forgot to start spawn-fcgi from console. Did it and everything is running like a charm. Thanks again!

 

By: Jimmie Hansson

Absolutely brilliant!

 Thanks for the informative and well-structured tutorial on this setup! You've made my day.

 Keep up the good work.

By: hjubal

It works like a charm! :)

By: Jean-Bruno

A absolutely perfect tutorial. Many thank. Special ovation to the "Make sure that there are some spaces between  include and fastcgi_params;  - in the default file this is written as one word which is a bug." wow !

By:

Great tutorial! Thank you Falko! I would just suggest that you use bigger code areas to eliminate scroll bars. Keep good work!

By: seno

Help me, followed the tutorial but in the end when i try to open in Firefox got 502 Bad Gateway

By: BigR

hey there. If try i two times now and i don't get it don. the server it self works fine but the php5 not!

i am a noob yes right ;)
 
 please can SB tell me how i can install that thing on 6.0.1 64 BIT? 
 after i create the info.php i get the 404 error not found!
 maybe you can told me how to edit the host file so that it works in any way! ;)

THX

By: Emanuel

You must probably add one line in ~ \.php$ location:

location ~ \.php$ { root /var/www; try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; include fastcgi_params; }

By: Anonymous

Thx for your comment. I'm using a different document root than /var/www. Without the try_files it worked according to the howto. However with try_files, I got an 404. After adding the root statement it works again :)

By: Joe Mighty

.. miss out removing apache2 completely (if debian 6 comes with it). Your resources WILL be depleted if apache2 is left on server, with nginx.

By: Tiberiu

Hey,

I've used this article to install nginx&php, but then I read another one which points that there's no need to install fast-cgi because php5-cgi processes can be started and run. So you can skip the step with lighttpd in this tutorial... which is a good start, btw.

Read this for further info: http://tomasz.sterna.tv/2009/04/php-fastcgi-with-nginx-on-ubuntu/

By: synth3tk

This was one of the most extremely helpful tutorials I've seen on nginx for Debian. Now I have PHP and MySQL up and running successfully. Thank you!!!

By: Donna

I read that setting cgi.fix_pathinfo=1 opens your webserver to exploits. According to this blog you should set it to false ie 0:

https://github.com/jyr/MNPP/issues/17

By: Pareen

When I run

"update-rc.d -f lighttpd remove" command, I get an error "update-rc.d: using dependency based boot sequencing".

Everything else goes fine. When I am trying to install "apt-get install php-apc" from your Drupal tutorial, I get the port 80 error again.

Any idea why this must be happening?

By: Pareen

With regards to my previous comment.

 

Found something here: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=17390&p=174866

 Cannot understand what it is.