How To Install LEMP On Ubuntu 12.04 - DC Geek

Breaking

DC Geek

I am still Learning

Follow By Mail

test banner

Post Top Ad

Responsive Ads Here

Post Top Ad

Responsive Ads Here

Sunday, September 15, 2013

How To Install LEMP On Ubuntu 12.04


LEMP server refers to server running Linux,nginx,MySQL and PHP.Nginx is a free open source HTTP server,It delivers high performance when compared with apache webserver.

It is similar to LAMP Server,the Difference is Nginx is Used in place of Apache

In this Tutorial I will Tell You how to install LEMP server on Ubuntu 12.04

Installation Procedure

Step 1:Login as root user

sudo su

Step 2: Install MySQL Client and MySQL Server

apt-get install mysql-server mysql-client

During installation It will ask you to create root password




Step 3: Install nginx

Nginx is available for ubuntu as a package and it is easy to install

apt-get install nginx

after installation restart nginx

/etc/init.d/nginx restart

Type Ipaddress or hostname in browser to verify nginx installed or not



Step 4: Install php

In this scenario php5 needs to work with nginx,so for that php-fpm we are going to install,if you site having more traffic then install php5-fpm

apt-get install php5-fpm

Step 5: Configure nginx

To Configure the nginx we need to edit the default file available in sites-available

vi /etc/nginx/sites-available/default



Modify the marked ones


  • Remove the comments given before listen on ipv4 & 6
  • Add the index.php to the root location
  • Remove the server name and give your server name or leave an undescore symbol
  • Add the line try_files $uri =404;
  • comment the line  fasrcgi_pass 127.0.0.1:9000;
Restart nginx after this modifications

/etc/init.d/nginx reload

Step 6:Install phpmyadmin

PHPmyadmin is very useful for managing the database,for instalaltion

apt-get install phpmyadmin

In phpmyadmin configuration don't select any webserver and click ok




Select NO 

After this open the file /etc/nginx/sites-available/default and paste the below lines after location ~ \.php$

location /phpmyadmin {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/phpmyadmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
               }
               location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /usr/share/;
               }
        }
        location /phpMyAdmin {
               rewrite ^/* /phpmyadmin last;
        }


Thats it LEMP server installed sucessfully on ubuntu...

No comments:

Post a Comment

Post Top Ad

Responsive Ads Here