DEV Community

Katz Ueno
Katz Ueno

Posted on

Nginx Simple Cheatsheet

This is my own Nginx cheatsheet. Checked with CentOS6, 7 and Amazon Linux and Amazon Linux 2

All commands are under assumption that you are root, or use with sudo

Start

nginx 
Enter fullscreen mode Exit fullscreen mode

Stop

CentOS 6 & Amazon Linux

nginx -s stop 
Enter fullscreen mode Exit fullscreen mode

CentOS 7 & Amazon Linux 2

systemctl stop nginx service nginx stop 
Enter fullscreen mode Exit fullscreen mode

Restart

entOS 6 & Amazon Linux

/etc/init.d/nginx restart 
Enter fullscreen mode Exit fullscreen mode

CentOS 7 & Amazon Linux 2

systemctl restart nginx service nginx restart 
Enter fullscreen mode Exit fullscreen mode

Register startup

CentOS 7 & Amazon Linux 2

systemctl enable nginx systemctl disable nginx 
Enter fullscreen mode Exit fullscreen mode

Reload config

CentOS6 & Amazon Linux

nginx reload service nginx reload 
Enter fullscreen mode Exit fullscreen mode

CentOS7 & Amazon Linux 2

systemctl reload nginx service nginx reload 
Enter fullscreen mode Exit fullscreen mode

Check config

nginx -t 
Enter fullscreen mode Exit fullscreen mode

General location of config

Main

cd /etc/nginx/ 
Enter fullscreen mode Exit fullscreen mode

Virtual hosts

cd /etc/nginx/conf.d/ 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)