Nginx is high performance Web Server. It's even more flexible and lightweight than Apache Server.

In this post, we would see how we could install Nginx on Ubuntu 17.04

Setup

We are using Ubuntu 17.04, updated version as of now.

# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 17.04
Release:	17.04
Codename:	zesty
# uname  -r
4.10.0-19-generic

# nginx -v
nginx version: nginx/1.10.3 (Ubuntu)

Install Nginx

In case of Ubuntu, its own repository has Nginx packages. So we can directly install Nginx from Ubuntu command apt-get install nginx

# apt-get install nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4 libxslt1.1 nginx-common nginx-core
Suggested packages:
  libgd-tools fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4 libxslt1.1 nginx nginx-common nginx-core
0 upgraded, 19 newly installed, 0 to remove and 4 not upgraded.
Need to get 2,507 kB of archives.
After this operation, 8,285 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Start Nginx Service

As above Nginx get installed in system, we need to start its service.

# ss -ntl| grep 80
# systemctl start nginx
# ss -ntl| grep 80
LISTEN     0      128          *:80                       *:*                  
LISTEN     0      128         :::80                      :::*         

# systemctl enable nginx
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx

Now try to connect machine from outside with IP Address. You get page like below