Nginx commands and configuration files location in Linux Mint / Ubuntu / Debian

NGINX stands for engine-x is a free, open-source, high-performance HTTP server and reverse proxy, as well as an mail (IMAP/POP3) proxy server. Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. Currently 146 million websites use NGINX to deliver super-fast web experiences. The big companies like (WordPress, facebook, GitHub & cloudflare, etc..) using nginx. For more details about Nginx

nginx Installation & Configuration

Nginx Service Commands
======================
Starting Nginx
# /etc/init.d/nginx start
# service nginx start

Restarting Nginx
# /etc/init.d/nginx restart
# service nginx restart

Stopping Nginx
# /etc/init.d/nginx stop
# service nginx stop
# nginx -s stop
# /usr/sbin/nginx -s stop

Status Nginx
# /etc/init.d/nginx status
# service nginx status

Reload Nginx
# /etc/init.d/nginx reload
# service nginx reload
# nginx -s reload

Nginx Graceful
# nginx -s quit


Nginx Important Files
=====================
Nginx Syntax check
# nginx -t
# nginx -t -c /etc/nginx/nginx.conf

Nginx Web root
# /usr/share/nginx/html - default
# /usr/share/nginx/ - New domain location

Nginx Config file's
# /etc/nginx/nginx.conf
# /etc/nginx/sites-available
# /etc/nginx/sites-enabled

Complied Nginx Modules
# nginx -V
# 2>&1 nginx -V | tr -- - '\n' | grep _module

Nginx log file's
# /var/log/nginx/access.log
# /var/log/nginx/error.log

Enable / Disable Virtual Hosts
# sudo ln -s /etc/nginx/sites-available/xxx.com /etc/nginx/sites-enabled/xxx.com
  • Start : To start nginx service/daemon
  • Stop : To stop nginx service/daemon
  • Restart : To restart nginx service/daemon
  • Status : To check nginx status whether its running or not
  • Reload : To reload the nginx.conf file
  • Enable Virtual Hosts : To enable newly added virtual host, In Nginx you need to create the symlink
  • Disable Virtual Hosts : To disable enabled virtual host. In Nginx you need to Remove the symlink
  • Syntax check : This will help you to dignoest the syntax error on nginx.conf file.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...