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
Stop
CentOS 6 & Amazon Linux
nginx -s stop
CentOS 7 & Amazon Linux 2
systemctl stop nginx
service nginx stop
Restart
entOS 6 & Amazon Linux
/etc/init.d/nginx restart
CentOS 7 & Amazon Linux 2
systemctl restart nginx
service nginx restart
Register startup
CentOS 7 & Amazon Linux 2
systemctl enable nginx
systemctl disable nginx
Reload config
CentOS6 & Amazon Linux
nginx reload
service nginx reload
CentOS7 & Amazon Linux 2
systemctl reload nginx
service nginx reload
Check config
nginx -t
General location of config
Main
cd /etc/nginx/
Virtual hosts
cd /etc/nginx/conf.d/
Top comments (0)