• Home
  • WordPress
  • web Hosting
    • Free hosting
    • Cheap Hosting
    • comparison cloud , vps, shared, wordpress
    • managed wordpress hosting
    • managed cloud hosting
  • page Speed
  • Deals
  • Services
  • About

RAaz Kumar .com

wordpress tutorials seo hosting etc


install LEMP Stack on 22.04 LTS Nginx MySQL PHP fpm #wordpress #digital ocean

how to install lemp stack on ubuntu 18.04 20.4 and debian 9, digitalocean google cloud for wordpress.

Prerequisites

Already Installed Ubuntu 18.04  12.04 22.04 LTS

1. Installing Lemp Stack easy method from linux repository

 

a. Easy Installing nginx from repo 

 

(i)sudo apt update && sudo apt upgrade

(II)  sudo apt-get install nginx

 

Optional: systemctl status nginx  (my case it worked always)

visit ipadress to see nginx page

most cases Port 80,443,22 will not block by ufw firewall or iptables.

(b) Installing Mysql 8 from ubuntu repository

 apt install mysql-server

follow the instructions

check installation status

sudo service mysql status

sudo mysql_secure_installation  and setpassword if not while installation
if no password login as sudo mysql and set password
change some rules.

(C) Installing Php fm 8 or 7.4 from ubuntu repository

apt install php-fpm  or specfic version

sudo apt-get install php7.4-fpm

apt-get install php7.4 -y

 

sudo apt install php8.1-fpm

and install required php extensions for WordPress etc

sudo apt install php8.1-curl php8.1-zip mcrypt php8.1-gd php8.1-mbstring php8.1-xmlrpc php8.1-xml php8.1-intl php8.1-soap php8.1-imagick

 

sudo service php8.1-fpm status

Detailed guide on installing php fpm on ubuntu

php ini configuration and  php fpm pool configuration

One command installation

sudo apt install nginx mysql-server php-fpm

also follow migrate linux server

Installing MySQL

 

Run the following commands

from Repo  (version may be 5.7 or 5.6)

sudo apt install mysql-server

 

Part 2: securing installation

sudo mysql_secure_installation

VALIDATE PASSWORD PLUGIN

password strength will be high.

Set: Root password, remove anonymous users etc(security hardening must for mysql installation.

Upgrading Mysql databases

Optional (use with caution)

mysql_upgrade u – root -p

if your migrating from old version to new ort if mysql log asks explicitly)

that’s all you done with mysql (performance tuning you need to visit this page)

 

Installing Php or Php -fpm

from repo

sudo apt install php-fpm

or

 

Php extensions for wordpress

sudo apt-get install php7.3-mysql php7.3-curl php7.3-json php7.3-cgi php7.3-xsl

or php fpm configuration with nginx and performance tuning please php installation page.

 

 

 

Semi Advanced LEMP Installation (not recommended)

 Installing Nginx From Source for latest 

visit http://nginx.org/en/download.html  scroll down to below prebuilt packages.

http://nginx.org/en/linux_packages.html

Select Linux distributions RHEL/Centos/ Ubuntu / debian etc

 

for Ubuntu

Ubuntu

Version Supported Platforms
14.04 “trusty” x86_64, i386, aarch64/arm64
16.04 “xenial” x86_64, i386, ppc64el, aarch64/arm64
18.04 “bionic” x86_64, aarch64/arm64
18.10 “cosmic” x86_64

 

 

1st step

Adding Repository to APT

To set up the apt repository for stable nginx packages, run the following command:

echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
    | sudo tee /etc/apt/sources.list.d/nginx.list
or

If you would like to use mainline nginx packages, run the following command instead:

echo "deb http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" \
    | sudo tee /etc/apt/sources.list.d/nginx.list

2nd step (maybe optional if ubuntu asks)

Next, import an official nginx signing key so apt could verify the packages authenticity:

curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -

Verify that you now have the proper key:

sudo apt-key fingerprint ABF5BD827BD9BF62

The output should contain the full fingerprint 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 as follows:

pub   rsa2048 2011-08-19 [SC] [expires: 2024-06-14]
      573B FD6B 3D8F BC64 1079  A6AB ABF5 BD82 7BD9 BF62
uid   [ unknown] nginx signing key <signing-key@nginx.com>

3rd & Final Step

To install nginx, 

sudo apt update && sudo apt install nginx

 

3.Installing PHP fpm 8

 

or from launchpad repo for specific version

https://launchpad.net/~ondrej/+archive/ubuntu/php

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php8.0-fpm

sudo apt-get install -y php8.0-fpm

sudo systemctl status php8.0-fpm

install required php extensions for wordpress 8

sudo apt install php8.0-mysql php8.0-curl php8.0-mbstring php8.0-opcache php8.0-zip php8.0-xml php8.0-gd

 

from source (Precompiled)

Install mysql 8  from mysql

Download MySQL APT repository

Ste p1:

Go to https://dev.mysql.com/downloads/repo/apt/

(mysql-apt-config_0.8.12-1_all.deb)

Wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb

Step 2

sudo dpkg -i mysql-apt-config_w.x.y-z_all.deb

ex: dpkg -i mysql-apt-config_0.8.12-1_all.deb

Step 3:

sudo apt-get update && sudo apt-get install mysql-server

 

Part 2: securing installation

 

root@ubuntu:~# sudo mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: n
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

… skipping.
By default, a 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 go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from
‘localhost’. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

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? (Press y|Y for Yes, any other key for No) : y
– Dropping test database…
Success.

– Removing privileges on test database…
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
root@ubuntu:~#

sudo mysql_secure_installation

 

Sample Nginx Server Block 

server {
listen 80;
root /var/www/html;

#remove below line add this to nginx.conf (to reduce code on every block)
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com;

location / {

#for wordpress not work replace with  try_files $uri $uri/ /index.php?$args;
try_files $uri $uri/ =404;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}

# remove locat .ht block i you are not using apache2

location ~ /\.ht {
deny all;
}
}

To start services

sudo systemctl start nginx

sudo systemctl stop nginx

sudo systemctl restart nginx

sudo systemctl reload nginx  (reload config files without restarting)

sudo systemctl status nginx (checking status whether it running or not)

 

Same applies php & Mysql

sudo systemctl restart php7.3-fpm

sudo systemctl restart mysql

 

Possible errors

Database not connected

 

check lemp stack version

nginx version

root@instance-1:~# nginx -v
nginx version: nginx/1.19.6
nginx version: nginx/1.19.9

php version

php -v
root@instance-1:~# php -v

PHP 7.4.14 (cli) (built: Jan 13 2021 08:04:47) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.14, Copyright (c), by Zend Technologies
PHP 8.0.3 (cli) (built: Mar 5 2021 07:53:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.3, Copyright (c) Zend Technologies
with Zend OPcache v8.0.3, Copyright (c), by Zend Technologies

linux distribution check lsb_release -a

root@instance-1:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal

mysql -V mysql version

root@instance-1:~# mysql -V
mysql Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

 

Nex thing Follow linux Server Migration or

wordpress lemp digitalocean

install lemp debian 9

Related topics:

  1. php fpm install ubuntu 20.04 nginx
  2. Lamp stack install on Ubuntu 20.4 LTS apache, mysql, php 7.4(Debian 9 & Ubuntu 18.04 lts)
  3. upgrade php fpm ubuntu nginx 7.4 to 8.2
  4. install phpmyadmin ubuntu nginx 22.04
  5. redis install ubuntu 20.04 with wordpress php redis mysql configuration

tutorials

  • Vivek Bindra Videos Transcription (business strategy)
  • git commands
  • new relic php agent install in 3 steps
  • new relic mysql install integration - 2 ways fix problems
  • new relic installation linux (infrastructure agent , php, mysql , nginx)
  • xampp tutorials 2021 installation errors fix wordpress phpmyadmin mysql apache
  • Redis performance metrics & tuning for nginx apache ubuntu & debian
  • Devops course Syllabus topics PDF AWS, Azure, cisco, redhat
  • CCNA Syllabus pdf (CCNA / CCNP vs devops vs mcsa /MCSE)
  • how to create a website free of cost on google
  • what is vpn vs proxy vs tor, http vs https, http2, tcp vs udp, kali linux sql source code injection
  • nginx server tutorials (installation, configuration, performance tuning, security)
    • nginx performance tuning
    • nginx add last modified header (remove, php wordpress)
    • upgrade php fpm ubuntu nginx 7.4 to 8.2
    • install phpmyadmin ubuntu nginx 22.04
    • php fpm install ubuntu 20.04 nginx
    • nginx upstream response is buffered to a temporary file
    • php fpm ondemand vs dynamic vs Static (the dynamic pool problem)
    • Php fpm configuration for 1000 concurrent connections server busy max children reached
    • php fpm seems busy fixed warning and max children reached to handle max connections / requests
    • newrelic nginx integration process and errors fix and metrics
    • datadog nginx integration installation process
    • nginx rate limiting explained by location time specific url
    • SSL faster reduce TLS hand shake improve https performance
    • monitor nginx request with nginx status amplify datadog new relic
    • nginx installation on ubuntu 20.04 LTS
    • enable brotli compression nginx brotli vs gzip
    • Letsencrypt SSL Installation on apache/Nginx ubuntu / debian wordpress
    • Top 10 tips to improve nginx server security
    • letsencrypt install configure on ubuntu / debian nginx
    • what is TTFB & how to Reduce it (server response time) Google pagespeed
    • php fpm restart nginx ubuntu enable status page, monitor etc
    • php fpm pool manager configuration settings based on server spike high cpu wordpress
    • nginx modules list (enable, disable, upgrade, install dynamic module)
    • nginx rewrite rules with examples 301 redirection
    • use nginx as reverse proxy and load balancer for apache wordpress
    • nginx conf explained best config file performance tuning tips nginx.conf location errors tutorial
    • nginx errors (504,502, 413, unable to start, syntax errors)
    • Pagespeed module install, configure, monitor, errors ft nginx &apache
    • Apache vs nginx (connection handling, modules, memory usage)
    • install LEMP Stack on 22.04 LTS Nginx MySQL PHP fpm #wordpress #digital ocean
    • nginx fastcgi cache wordpress how to configure
    • fix error 520 522 524 on cloudflare wordpress godaddy nginx etc
  • MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS
  • AUdio Editing Background Noise removal (Audacity, Adobe Premiere Addition, Camtasia Filmora Windows Obs)
  • Android Studio tutorials syllabus Topics Course details #AndroidApplicationDevelopment
  • [INTRO] Ethical hacking / cyber Security / Penetration testing Tutorial -{updates frequently}
  • redis install ubuntu 20.04 with wordpress php redis mysql configuration
  • ubuntu tutorials installation download issues etc
  • Php tutorials
  • HTML & CSS Tutorials
  • Core Java Tutorial Free online
  • Linux sysadmin tutorials linux system administrator
  • apache server tutorial (install,config, performance tuning, security, error handling)

 

 

wordpress Pagespeed optimization

Digitalocean free $100 Credit

Cloudways Review pricing promo codes

Siteground cpu limits Pricing

Shared Hosting

Managed wordpress Hosting

Managed Hosting Cloud server

VPS Hosting

Cloud Hosting – Unmanaged

Google cloud Pricing

Aws Pricing

Azure pricing

nginx server tutorials

apache server tutorials

linux sysadmin tutorials

mysql Commands list pdf

LEMP Install Ubuntu

Mysql Performance Tuning

Nginx Performance tuning

Linux Performance tuning

Php -fpm performance tuning

Redis Performance tuning

linux server security

nginx security best practices

wordpress security plugins

 

 

wordpress

 

Top 5  WP Google Analytics Plugins

WP Backup Plugins

Wp Comment Plugins

Top wordpress Security Plugins

WP Seo Plugins

WP Caching Plugins

Best Adsense Plugins for WordPress

Wp social Sharing Plugins

autoshare social media plugins

WP speed Optimization Plugins

Speedup WordPress google Score

More Wp tuts

Server Admin Cloud

 

Installing Nginx LEMP On ubuntu

Installing apache Lamp ubuntu

nginx fastcgi cache enable

php – fpm install  & Configuration

Opcache install & Configure

php -fpm pool manager explained

Mysql Install & Configuration

Redis Object cache install & configure

 

Nginx as Reverse Proxy and Load balancer

Load Balance / auto scaling in google cloud

Linux Commands PDF

Mysql Commands Pdf

Letsencrypt tutorial

mysqldump export & import 

Pagespeed Module install & configure

nginx.conf best file

mysql.conf best file

upgrade ubuntu

© 2023 - All Rights Reserved Disclaimer & Privacy Policy