Categories
DevOps

Learning NGINX

Install NGINX

sudo su -
apt update
apt upgrade
apt install nginx
nginx -v

Confirm NGINX is working by navigation to localhost

NGINX Files and Directories

  • /etc/nginx (Configurations)
  • var/log/nginx (Access and error logs)
  • var/www/html (Default directory)

Commonly Used Commands

systemctl status nginx # check status
systemctl start nginx # start server
systemctl stop nginx # stop server
systemctl is-active nginx
systemctl reload nginx
nginx -h # help
nginx -t # test config without reboot
nginx -T # test config and cat file on screen

Main configuration file of nginx is located in /etc/nginx/nginx.conf (review this) but we will keep our configuration in /etc/nginx/conf.d

Unlink default unlink /etc/nginx/sites-enabled/default