Default Green Orange
Swifty's Blog
James Irving-Swift's portfolio and random blogging
RSS
  • Home Page Home
  • My CV

Posts Tagged ‘nginx’

Quick Start guide to install LEMP server on Ubuntu 12.04 (Linux + Nginx + MySql + PHP )

Linux, Ubuntu 6 Comments »

I have seen some online guides about this but really was after one specific to Ubuntu 12.04. So here goes:

Step 1 – Installing Nginx

First we need to add the Nginx source

sudo add-apt-repository ppa:nginx/stable

Next, as we always do after adding a source, we need to update

sudo apt-get update

And now we install it

sudo apt-get install nginx

Next, we must start the Nginx service.

sudo /etc/init.d/nginx start

To check if it is successful, try going to http://localhost/ in your browser. If you see a Welcome to Nginx page, it has been successful.

Step 2 – Installing PHP5:

Install PHP and any required extensions

sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql

Edit the default Nginx site config (if you are not familiar with vim, try entering ‘nano’ instead)

sudo vim /etc/nginx/sites-available/default

The changes you will need to make are as follows:
1)

index index.html index.htm;

to

index index.html index.htm index.php;

2)

root /srv/http/nginx;

^this path may be different in your install, it doesn’t matter as we are changing it!
to:

root /var/www;

3) uncomment the following lines

 location ~ \.php$ {
     fastcgi_pass 127.0.0.1:9000;
     fastcgi_index index.php;
     include fastcgi_params;
  }

Now quit vim (‘:wq’) and restart the nginx service.

sudo /etc/init.d/nginx restart

If the folder /var/www/ doesn’t exist, create it

sudo mkdir /var/www/

Step 3 – Install MySQL

And finally,

sudo apt-get install mysql-server

Step 4 – Check it works!

Create a test file

vim /var/www/test.php

Add this line

<?php phpinfo();?>

Save and quit vim (:wq) and go to http://localhost/test.php in your browser.
If you see a page displaying all your PHP settings, then it works!


May 2nd, 2012  
Tags: LEMP, Linux, Mysql, nginx, Ubuntu



  • Search

  • Calendar

    May 2013
    M T W T F S S
    « May    
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
  • My Twitter

    • @skyatlantic why is sky atlantic HD the only channel that apparently can get signal?!? 2 days ago
    • @miniviolette it was… I realised that I was to drunk to continue when I only got one kill in battlefield3 in 30 mins!!!! epic fail! 4 days ago
    • @miniviolette yeah! i just stay in an played xbox and didn't pay attention to how much I was drinking at the same time! Amateur Mistake! 4 days ago
    • This sums up my Saturday morning! http://t.co/yBuMQ0afMy 4 days ago
    • @Rich_McCartney I'm still on Lion, i really need to sort out mountain lion so that my thunderbolt display stops being buggy! 5 days ago
  • Categories

    • Development
    • Development
    • JISCMail
    • Just for fun
    • Linux
    • Magento
    • Mailtalk
    • Mutiny
    • Random
    • Thomas Murr Art
    • Ubuntu
    • Websites
    • Wordpress
  • Archives

    • May 2012
    • March 2012
    • November 2011
    • May 2011
    • October 2010
    • September 2010
    • July 2010
    • April 2010
    • March 2010
    • SN205662 Samsung digital camera
    • SN205661 Samsung digital camera
    • SN205660 Samsung digital camera
    • SN205658 Samsung digital camera
    • SN205659 Samsung digital camera
    • SN205657 Samsung digital camera
    • SN205656 Samsung digital camera
    • SN205655 Samsung digital camera
    • SN205654 Samsung digital camera
    • SN205653 Samsung digital camera
    • SN205651 Samsung digital camera
    • SN205652 Samsung digital camera
    • SN205650 Samsung digital camera
    • SN205649 Samsung digital camera
    • SN205648 Samsung digital camera
    • SN205644 Samsung digital camera
    • SN205625 Samsung digital camera
    • SN205639 Samsung digital camera
    • SN205626 Samsung digital camera
    • SN205636 Samsung digital camera
Copyright © 2013 Swifty's Blog
XHTML CSS Log in