debian/ubuntu install nginx php mysql

If you are not root, run sudo before following.

1) apt-get update

2) apt-get upgrade

apt-get install vim

3) aptitude install mysql-server mysql-client

In /etc/mysql/my.cnf

add “skip-innodb”

4) aptitude install nginx

/etc/init.d/nginx start

Note: You could browse your site now.

chown –R :www-data /var/www

5) Following steps like:

6) /usr/bin/spawn-fcgi -a -p 9000 -C 8 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/

7) vi /etc/rc.local, add

/usr/bin/spawn-fcgi -a -p 9000 -C 8 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/

8 )  vi /etc/nginx/sites-available/default

some places need to note:

a) Note the root directory.

location / {

root /var/www/nginx-default;

index index.php index.html index.htm;


b) add following php support:

location ~ \.php$ {


fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;

include fastcgi_params;


“debian/ubuntu install nginx php mysql”的一个回复