Skip to main content

Nginx Cheatsheet

Configuration files

  • /etc/nginx/nginx.conf
  • /etc/nginx/sites-available/*
  • /etc/nginx/sites-enabled/*
# start stop restart status
$ sudo service nginx start
$ sudo service nginx stop
$ sudo service nginx restart

$ systemctl status nginx

# check nginx configuration for syntax errors
$ sudo nginx -t

$ nginx -s stop
$ nginx -s reload
$ nginx -s reopen
$ nginx -s quit
# basic server block structure
server {
  listen 80;
  server_name example.com www.example.com;
  location / {
    # other configurations
  }
}