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

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...SaltStack
 
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
 
Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11Yury Pliashkou
 
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 environmentsBenjamin Cane
 
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 Servicesponukumatla joel nishanth
 
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 platformAjeet Singh
 
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 - LAMPMatt Dunlap
 
Apache Presentation
Apache PresentationApache Presentation
Apache PresentationAnkush Jain
 
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 BalancerVCP Muthukrishna
 
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 REXSaewoong Lee
 
Puppet Camp Ghent 2013
Puppet Camp Ghent 2013Puppet Camp Ghent 2013
Puppet Camp Ghent 2013Server Density
 
Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16Enrique Davila
 
Installing apache sqoop
Installing apache sqoopInstalling apache sqoop
Installing apache sqoopEnrique Davila
 
Installing hive on ubuntu 16
Installing hive on ubuntu 16Installing hive on ubuntu 16
Installing hive on ubuntu 16Enrique Davila
 

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 занятия
конспект 7 занятияконспект 7 занятия
конспект 7 занятияAlexander Randelf
 
Dawn Marine 2016 Catalog
Dawn Marine 2016 CatalogDawn Marine 2016 Catalog
Dawn Marine 2016 CatalogDawn Marine
 
211140032 최정은 아웃라이어
211140032 최정은 아웃라이어211140032 최정은 아웃라이어
211140032 최정은 아웃라이어CJE92
 
Lean Startup Intensive Workshop (Thai)
Lean Startup Intensive Workshop (Thai)Lean Startup Intensive Workshop (Thai)
Lean Startup Intensive Workshop (Thai)Man Chavayot Pomcum
 
CUENTO - LA MARIPOSA CURIOSA
CUENTO - LA MARIPOSA CURIOSACUENTO - LA MARIPOSA CURIOSA
CUENTO - LA MARIPOSA CURIOSAClaudia Olivera
 

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

Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
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 8Raja Rozali Raja Hasan
 
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 serverwruben
 
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 UbuntuWirabumi Software
 
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 CloudDropsolid
 
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]Dana Luther
 
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 JonesOrtus Solutions, Corp
 
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 - CascadiaDana Luther
 
Professional deployment
Professional deploymentProfessional deployment
Professional deploymentIvelina Dimova
 
[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning InfrastructurePerforce
 
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 scalabilityWim Godden
 
Managing and Monitoring Application Performance
Managing and Monitoring Application PerformanceManaging and Monitoring Application Performance
Managing and Monitoring Application PerformanceSebastian Marek
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
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 ITaien Wang
 
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)Justin Foell
 

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

Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewingbigorange77
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...akbard9823
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of indiaimessage0108
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 

Recently uploaded (20)

Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewing
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of india
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 

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.