What is the easiest way to enable PHP on nginx on Ubuntu 12.04?
Best solution is the one that request minimal work, ideally just a package installation :)
|
|
|
The following method will get you started fast on Ubuntu 12.04: Install the dependences:
Install nginx:
Start nginx:
Test that it's working (should see "Welcome to nginx!")
In your nginx site configuration (/etc/nginx/sites-available/default), modify the line in the server {} section
Uncomment the lines in the server {} section starting with
Scroll down to where it says "location ~ .php {" and uncomment lines so it looks like this:
Your default web root is located at /usr/share/nginx/www (per the config file). (See (Note: For Ubuntu 12.10 or newer, you will need to replace the |
|||||||||||||||||||||
|
|
EDIT: As pointed out by Matt Browne you may be interested by this more recent post: The papashou's answer is correct on old Ubuntu 12.04. Since Ubuntu 12.10, the configuration is a bit different. Here is what I did: Install
Enable PHP Uncomment the following lines in configuration file
Start (or restart)
Test Opening this link Test Create a php file:
Opening |
|||||||||
|