The following method will get you started fast on Ubuntu 12.04;
sudo apt-get install php5-common php5-cli php5-fpm
sudo apt-get install nginx
sudo service nginx start
Test that it's working (should see "Welcome to nginx!")
sudo service nginx stop
In your nginx site configuration (/etc/nginx/sites-available/default), uncomment the lines in the server {} section starting with
listen
for ipv4 / ipv6 both.
scroll down to where it says "location ~ .php {" and uncomment lines so it looks like this:
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
sudo service php5-fpm restart
sudo service nginx restart
Your default web root is located at /usr/share/nginx/www (per the config file). (See
root /usr/share/nginx/www;
(Note1: For Ubuntu 12.10 or newer, you will need to replace the
fastcgi_pass 127.0.0.1:9000;
line with this to make it work: fastcgi_pass unix:/var/run/php5-fpm.sock;
)
Note2: remember to include "index.php" as follows:
index index.html index.htm index.php;
Post a Comment