SlideShare a Scribd company logo
1 of 11
Introduction:
Here is this article you will learn how to install and configure LEMP stack
“Linux, nginx, MySQL,PHP"
Firstof all you will need to know more about LEMPstack. LEMPstack is a
group of open source software to get web servers up and running. LEMP
Stack used to power many popular web applications. "LEMP" refers to a
Linux-based operatingsystem, the Nginx web server, the MySQL database
server, and the PHP programinglanguage.It is common to substitute other
programinglanguages likePython, Perl, and even Ruby for PHP. The
"LEMP" configuration replaces the Apache web server component with
nginx (pronounced "engine x," providing the "E" in LEMP) to increase the
abilityof the server to scale in response to demand.
Kindly note the following:
 The steps in this article require the user to have a root privileges on the operating
system.
 This article is installed on VPS with Centos 6.5 x86_64 GNU/Linux.
 Nginx version: nginx/1.6.2
 PHP 5.3.3
 Mysql DB Server version: 5.1.73
Steps of installation:
First Step— “Update”:
As mentioned above, the steps in this article require the user to have a root
privileges on the operating system.
Firstthing to do after installingthe operating system is to have your
system updated, and this could be done through the following command:
yum -y update
Second step—“Installnginx”
In order to install nginx youhave to add nginx yum repository.
Create a file named /etc/yum.repos.d/nginx.repoand paste the
configurations below:
[nginx]
name=nginxrepo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
* Then install nginx using the following command :
yum install nginx
Service nginx start
After installingnginx youcan test nginx to verify thateverything wentas
planned by visiting your server's publicIP address in your web browser
http://server_domain_name_or_IP/
You will see the default Nginx web page, It should look something like
this:
Third step—Install PHP and PHP modules
*Install the rpmforge and epel repositories:
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -Uvh
http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-
1.el6.rf.x86_64.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-
8.noarch.rpm
* Then install php:
yum install php php-fpm php-common php-pecl-apc php-cli php-pear
php-pdo php-mysql php-pgsql php-pecl-memcached php-gd php-
mbstring php-mcryptphp-xml php-pecl-memcache.x86_64 php-gd php-
mbstring php-mcryptphp-xml phpMyAdmin
Fourth step—Configure nginx
* Firstyou will need to add new users and create their directories
 adduser site1
 passwd site1
 cd /home/site1
 mkdir {public_html,logs}
 touch logs/{error.log,access.log}
 chown -R site1:site1 /home/site1
 chmod 755 /home/site1
* Create a new virtual host file for your site with the following
configuration :-
vim /etc/nginx/conf.d/site1.conf
server {
listen 80;
server_name domainname
#charsetkoi8-r;
error_log /home/site1/logs/error.log;
access_log /home/site1/logs/access.log;
location / {
root /home/site1/public_html;
index index.phpindex.htmlindex.htm;
try_files $uri $uri/ index.php;
}
error_page 404 /404.html;
location = /404.html{
root /home/site1/public_html;
}
# redirectserver error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/site1/public_html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGIserver listening on 127.0.0.1:9000
location ~ .php$ {
root /home/site1/public_html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_
name;
include fastcgi_params;
}
location /phpMyAdmin {
root /usr/share;
index index.phpindex.html index.htm;
location ~ ^/phpMyAdmin/(.+.php)$ {
try_files $uri =404;
root /usr/share;
fastcgi_pass 127.0.0.1:9000;
fastcgi_indexindex.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 ^/*/phpMyAdminlast;
}
}
Fifth step—Configure php-FPM
With PHP-FPM it’s possible to use differentpools for different sites and
allocate resources accurately.
An exampleofconfigurationsfor every pool:
/etc/php-fpm.d/site.conf
[site1]
listen = 127.0.0.1:9000
user = site1
group = site1
request_slowlog_timeout= 5s
slowlog = /var/log/php-fpm/slowlog-site.log
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 5
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 200
listen.backlog = -1
pm.status_path = /status
request_terminate_timeout= 120s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output= yes
env[HOSTNAME]= $HOSTNAME
step—Install MySQL
Install MySql using the following command:
yum install mysql mysql-server
· Run MySQL set up script
sudo /usr/bin/mysql_secure_installation
The prompt will ask you for your current root password.
Type it in.
Enter current password for root (enter for none).
OK, successfully used password, move on...
Then the prompt will ask you if you wantto change the root password. Go
ahead and choose N and move on to the next steps.
Note :- It’s easy just to say Yes to all the options. At the end, MySQL will
reload and implementthe new changes.
By default, MySQL installation has an anonymous user, allowing anyone to
log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation goa
bit smoother. You should remove them before moving into the production
environment.
Remove anonymous users? [Y/n] y
Success!
Normally, rootshould only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow rootlogin remotely?[Y/n] y
Success!
Note: By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing, and should be
removed before moving into a production environment.
Remove test database and access to it? [Y/n] y
Drop test database
Success!
Remove privileges on test database
Success!
Reloadingthe privilegetables will ensure thatall changes made so far will
take effect immediately.
Reload privilege tables now?[Y/n] y
Success!
Seventh step—TestingYourwebsite:
You can quickly see all the details of the new php configuration.
To set this up, firstcreate a new file:
vim /home/site1/public_html/index.php
Add in the following line:
<?php
phpinfo();
?>
Finally Save and Exit.
Start services
 service nginx start
 service php-fpm start
 service mysqld start
Auto start services when the server starts
 chkconfig nginx on
 chkconfig php-fpm on
 chkconfig mysqld on
You can see php details by visiting http://youripaddress/
The page that you visitshould look like this:
This page basically gives youinformation aboutyour server from the
perspective of PHP. It is useful for debugging and to ensure that your
settings are being applied correctly.
You probablywantto remove this file after testing because it could give
information aboutyour server to unauthorized users.
By Now your LEMPstack is now setup and configured on your
virtual private server, and youhave many choices for what to do next.
Basically, you've installeda platform that will allow you to install most
kinds of web application.

More Related Content

What's hot

Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Simon Boulet
 
Build your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web ServicesBuild your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web Services
ponukumatla joel nishanth
 

What's hot (20)

SaltConf14 - Ryan Lane, Wikimedia - Immediate consistency with Trebuchet Depl...
SaltConf14 - Ryan Lane, Wikimedia - Immediate consistency with Trebuchet Depl...SaltConf14 - Ryan Lane, Wikimedia - Immediate consistency with Trebuchet Depl...
SaltConf14 - Ryan Lane, Wikimedia - Immediate consistency with Trebuchet Depl...
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
 
Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11
 
Ansible best practices
Ansible best practicesAnsible best practices
Ansible best practices
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
Build your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web ServicesBuild your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web Services
 
Setup Kubernetes with flannel on ubuntu platform
Setup Kubernetes with flannel on ubuntu platformSetup Kubernetes with flannel on ubuntu platform
Setup Kubernetes with flannel on ubuntu platform
 
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPHow To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
 
Readme
ReadmeReadme
Readme
 
Apache Presentation
Apache PresentationApache Presentation
Apache Presentation
 
Powershell direct
Powershell directPowershell direct
Powershell direct
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
How To Configure Amazon EC2 Load Balancer
How To Configure Amazon EC2 Load BalancerHow To Configure Amazon EC2 Load Balancer
How To Configure Amazon EC2 Load Balancer
 
Ansible : what's ansible & use case by REX
Ansible :  what's ansible & use case by REXAnsible :  what's ansible & use case by REX
Ansible : what's ansible & use case by REX
 
Puppet Camp Ghent 2013
Puppet Camp Ghent 2013Puppet Camp Ghent 2013
Puppet Camp Ghent 2013
 
Step by-step installation of a secure linux web dns- and mail server
Step by-step installation of a secure linux web  dns- and mail serverStep by-step installation of a secure linux web  dns- and mail server
Step by-step installation of a secure linux web dns- and mail server
 
Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16
 
Installing apache sqoop
Installing apache sqoopInstalling apache sqoop
Installing apache sqoop
 
Installing hive on ubuntu 16
Installing hive on ubuntu 16Installing hive on ubuntu 16
Installing hive on ubuntu 16
 
grate techniques
grate techniquesgrate techniques
grate techniques
 

Viewers also liked (7)

Albert einstein
Albert einsteinAlbert einstein
Albert einstein
 
конспект 7 занятия
конспект 7 занятияконспект 7 занятия
конспект 7 занятия
 
Dawn Marine 2016 Catalog
Dawn Marine 2016 CatalogDawn Marine 2016 Catalog
Dawn Marine 2016 Catalog
 
211140032 최정은 아웃라이어
211140032 최정은 아웃라이어211140032 최정은 아웃라이어
211140032 최정은 아웃라이어
 
Lean Startup Intensive Workshop (Thai)
Lean Startup Intensive Workshop (Thai)Lean Startup Intensive Workshop (Thai)
Lean Startup Intensive Workshop (Thai)
 
CUENTO - LA MARIPOSA CURIOSA
CUENTO - LA MARIPOSA CURIOSACUENTO - LA MARIPOSA CURIOSA
CUENTO - LA MARIPOSA CURIOSA
 
Mariposita va a la escuela
Mariposita va a la escuelaMariposita va a la escuela
Mariposita va a la escuela
 

Similar to How to install and configure LEMP stack

[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
Perforce
 

Similar to How to install and configure LEMP stack (20)

Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8
 
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverNginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
 
EC CUBE 3.0.x installation guide
EC CUBE 3.0.x installation guideEC CUBE 3.0.x installation guide
EC CUBE 3.0.x installation guide
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
 
Lumen
LumenLumen
Lumen
 
Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]
 
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin JonesITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
 
Converting Your Dev Environment to a Docker Stack - Cascadia
Converting Your Dev Environment to a Docker Stack - CascadiaConverting Your Dev Environment to a Docker Stack - Cascadia
Converting Your Dev Environment to a Docker Stack - Cascadia
 
zLAMP
zLAMPzLAMP
zLAMP
 
Professional deployment
Professional deploymentProfessional deployment
Professional deployment
 
[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Managing and Monitoring Application Performance
Managing and Monitoring Application PerformanceManaging and Monitoring Application Performance
Managing and Monitoring Application Performance
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
20151229 wnmp & phalcon micro app - part I
20151229 wnmp & phalcon micro app - part I20151229 wnmp & phalcon micro app - part I
20151229 wnmp & phalcon micro app - part I
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)
 

Recently uploaded

( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 

Recently uploaded (20)

( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 

How to install and configure LEMP stack

  • 1.
  • 2. Introduction: Here is this article you will learn how to install and configure LEMP stack “Linux, nginx, MySQL,PHP" Firstof all you will need to know more about LEMPstack. LEMPstack is a group of open source software to get web servers up and running. LEMP Stack used to power many popular web applications. "LEMP" refers to a Linux-based operatingsystem, the Nginx web server, the MySQL database server, and the PHP programinglanguage.It is common to substitute other programinglanguages likePython, Perl, and even Ruby for PHP. The "LEMP" configuration replaces the Apache web server component with nginx (pronounced "engine x," providing the "E" in LEMP) to increase the abilityof the server to scale in response to demand. Kindly note the following:  The steps in this article require the user to have a root privileges on the operating system.  This article is installed on VPS with Centos 6.5 x86_64 GNU/Linux.  Nginx version: nginx/1.6.2  PHP 5.3.3  Mysql DB Server version: 5.1.73 Steps of installation: First Step— “Update”: As mentioned above, the steps in this article require the user to have a root privileges on the operating system. Firstthing to do after installingthe operating system is to have your system updated, and this could be done through the following command: yum -y update
  • 3. Second step—“Installnginx” In order to install nginx youhave to add nginx yum repository. Create a file named /etc/yum.repos.d/nginx.repoand paste the configurations below: [nginx] name=nginxrepo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 * Then install nginx using the following command : yum install nginx Service nginx start After installingnginx youcan test nginx to verify thateverything wentas planned by visiting your server's publicIP address in your web browser http://server_domain_name_or_IP/ You will see the default Nginx web page, It should look something like this:
  • 4. Third step—Install PHP and PHP modules *Install the rpmforge and epel repositories: rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3- 1.el6.rf.x86_64.rpm rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6- 8.noarch.rpm * Then install php: yum install php php-fpm php-common php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-memcached php-gd php- mbstring php-mcryptphp-xml php-pecl-memcache.x86_64 php-gd php- mbstring php-mcryptphp-xml phpMyAdmin Fourth step—Configure nginx * Firstyou will need to add new users and create their directories  adduser site1  passwd site1  cd /home/site1  mkdir {public_html,logs}  touch logs/{error.log,access.log}  chown -R site1:site1 /home/site1  chmod 755 /home/site1 * Create a new virtual host file for your site with the following configuration :- vim /etc/nginx/conf.d/site1.conf server { listen 80; server_name domainname
  • 5. #charsetkoi8-r; error_log /home/site1/logs/error.log; access_log /home/site1/logs/access.log; location / { root /home/site1/public_html; index index.phpindex.htmlindex.htm; try_files $uri $uri/ index.php; } error_page 404 /404.html; location = /404.html{ root /home/site1/public_html; } # redirectserver error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /home/site1/public_html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 #
  • 6. #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGIserver listening on 127.0.0.1:9000 location ~ .php$ { root /home/site1/public_html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_ name; include fastcgi_params; } location /phpMyAdmin { root /usr/share; index index.phpindex.html index.htm; location ~ ^/phpMyAdmin/(.+.php)$ {
  • 7. try_files $uri =404; root /usr/share; fastcgi_pass 127.0.0.1:9000; fastcgi_indexindex.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 ^/*/phpMyAdminlast; } }
  • 8. Fifth step—Configure php-FPM With PHP-FPM it’s possible to use differentpools for different sites and allocate resources accurately. An exampleofconfigurationsfor every pool: /etc/php-fpm.d/site.conf [site1] listen = 127.0.0.1:9000 user = site1 group = site1 request_slowlog_timeout= 5s slowlog = /var/log/php-fpm/slowlog-site.log listen.allowed_clients = 127.0.0.1 pm = dynamic pm.max_children = 5 pm.start_servers = 3 pm.min_spare_servers = 2 pm.max_spare_servers = 4 pm.max_requests = 200 listen.backlog = -1 pm.status_path = /status request_terminate_timeout= 120s rlimit_files = 131072 rlimit_core = unlimited catch_workers_output= yes env[HOSTNAME]= $HOSTNAME
  • 9. step—Install MySQL Install MySql using the following command: yum install mysql mysql-server · Run MySQL set up script sudo /usr/bin/mysql_secure_installation The prompt will ask you for your current root password. Type it in. Enter current password for root (enter for none). OK, successfully used password, move on... Then the prompt will ask you if you wantto change the root password. Go ahead and choose N and move on to the next steps. Note :- It’s easy just to say Yes to all the options. At the end, MySQL will reload and implementthe new changes. By default, MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation goa bit smoother. You should remove them before moving into the production environment. Remove anonymous users? [Y/n] y Success! Normally, rootshould only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow rootlogin remotely?[Y/n] y Success!
  • 10. Note: By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y Drop test database Success! Remove privileges on test database Success! Reloadingthe privilegetables will ensure thatall changes made so far will take effect immediately. Reload privilege tables now?[Y/n] y Success! Seventh step—TestingYourwebsite: You can quickly see all the details of the new php configuration. To set this up, firstcreate a new file: vim /home/site1/public_html/index.php Add in the following line: <?php phpinfo(); ?> Finally Save and Exit.
  • 11. Start services  service nginx start  service php-fpm start  service mysqld start Auto start services when the server starts  chkconfig nginx on  chkconfig php-fpm on  chkconfig mysqld on You can see php details by visiting http://youripaddress/ The page that you visitshould look like this: This page basically gives youinformation aboutyour server from the perspective of PHP. It is useful for debugging and to ensure that your settings are being applied correctly. You probablywantto remove this file after testing because it could give information aboutyour server to unauthorized users. By Now your LEMPstack is now setup and configured on your virtual private server, and youhave many choices for what to do next. Basically, you've installeda platform that will allow you to install most kinds of web application.