=== CLI NGINX ===
#cd /etc/nginx
# ls -ltr
#cd /var/log/nginx
#cd /var/www
—–
# sudo su –
$ systemctl status nginx
$ systemctl status nginx –no-pager
$ systemctl is-active nginx
$ systemctl start/stop nginx
— reload all config files —
$ systemctl reload nginx
— test config files —–
# nginx -t
# nginx -T | less
=== nginx.conf ===
#view /etc/nginx/nginx.conf
Alphabetical index of directives
http://nginx.org/en/docs/dirindex.html
— unlink default conf —
#sudo -s
#cd /etc/nginx/sites-enabled/
#unlink default
— create a new conf–
#vim /etc/nginx/conf.d/<site name>.local.conf
#cat /etc/nginx/conf.d/<site name>.local.conf
#nginx -t
How nginx processes a request
From <http://nginx.org/en/docs/http/request_processing.html>
#curl localhost
=== Vagrant ===
#vagrant ssh
#which unzip
#apt install unzip
#unzip -o <file>.zip -d /var/www/<site name>.local.conf
— change permission —
#find /var/www/<site name>.local/ -type f -exec chmod 644 {} \;
#find /var/www/<site name>.local/ -type d -exec chmod 755 {} \;
=== Configure locations ===
http://nginx.org/en/docs/http/ngx_http_core_module.html#location
# for i in {1..10}; do curl localhost > dev/null; done
# for i in {1..10}; do curl localhost/images/ > dev/null; done
=== Verify the Ports ===
# sudo lsof -P -n -i :80 -i :443 | grep LISTEN
# sudo netstat -plan | grep nginx
# tail -f /var/logs/nginx/*.log