Nginx - Basic Configurations

Nginx - Basic Configurations

kickstart with webserver..

Nginx is a web server that can be used for various purposes which are:

  • Load balancer

  • Reverse proxy

  • Content cache

  • Webserver

  • Ingress Controller

For more details, one can refer to their official site.

But here we will try to build a quick understanding of Nginx which helps us to launch a web application instantly.

For simplicity here Nginx will be installed on the Ubuntu machine.

Nginx can be installed as

apt install nginx -y

Check Nginx status

systemctl status nginx

Once Nginx gets installed:

  • The Nginx binary resides inside /usr/sbin/nginx

  • Nginx config directory path : /etc/nginx

  • Nginx master config file: /etc/nginx/nginx.conf

  • Service Unit file: /lib/systemd/system/nginx.service

Let's explore nginx binary

nginx -h

By seeing this output we can say, two major commands which we use very frequently are:

To validate nginx configuration

nginx -t

To reload nginx configuration without restarting nginx:

nginx -s reload