Note: Installation Process of ubuntu & debian almost same. but we have to choose distribution code.
also follow lemp installation process
Mainline or stable nginx (we choose mainline for latest features as well security updates)
stable only security updates (recommended long term deployments maybe)
Easy Method 1 : Installing Prebuilt Debian Packages
sudo apt-get update && sudo apt-get install nginx
check nginx version
nginx -V
sudo nginx -v
nginx version: nginx/1.6.2
Installing Prebuilt Ubuntu Packages
NGINX provides packages for the following Ubuntu operating systems:
Version Codename Supported Platforms
16.04 xenial x86_64, i386, ppc64el, aarch64/arm64
18.04 bionic x86_64, aarch64/arm64
19.10 eoan x86_64
20.04 focal x86_64, aarch64/arm64
installing nginx from Ubuntu Repository
sudo apt-get update && sudo apt-get install nginx
2. Prebuilt Ubuntu Package from the Official NGINX Repository
Before installing nginx make sure to know which module need to add follow nginx modules list
https://nginx.org/en/linux_packages.html
Install the prerequisites:
sudo apt install curl gnupg2 ca-certificates lsb-release
a.Add nginx keys
sudo wget https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
Verify that you now have the proper key:
sudo apt-key fingerprint ABF5BD827BD9BF62
b. add nginx repository apt sources list
nano /etc/apt/sources.list
deb https://nginx.org/packages/mainline/ubuntu/ <CODENAME> nginx
deb-src https://nginx.org/packages/mainline/ubuntu/ <CODENAME> nginx
Mainline or stable
codename = replace with ubuntu 20.04 or 18.04 bionic version
mycase:
deb https://nginx.org/packages/mainline/ubuntu/ focal nginx
deb-src https://nginx.org/packages/mainline/ubuntu/ focal nginx
sudo apt-get update && sudo apt-get install nginx
check nginx installed version
nginx -V
check whether it(nginx status modules) enabled or not
nginx -V 2>&1 | grep -o with-http_stub_status_module
root@instance-1:~# nginx -v
nginx version: nginx/1.19.6 (changelog
install nginx with stub status module & Brotil
./configure
–with-http_stub_status_module
–with-compat –add-dynamic-module=../ngx_brotli
Next Follow LEMP Stack Installation Process or mysql installation ubuntu,
php -fpm installation on ubuntu