1.安裝Nginx源
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.安裝Nginx
yum install -y nginx
3.查看Nginx版本
nginx -v
4.查看Nginx相關(guān)路徑
whereis nginx
nginx: /usr/sbin/nginx ????/usr/lib64/nginx ????/etc/nginx ? ?/usr/share/nginx ? ?/usr/share/man/man8/nginx.8.gz
以下是Nginx的默認(rèn)路徑:
(1) Nginx配置路徑:/etc/nginx/
(2) PID目錄:/var/run/nginx.pid
(3) 錯(cuò)誤日志:/var/log/nginx/error.log
(4) 訪問日志:/var/log/nginx/access.log
(5) 默認(rèn)站點(diǎn)目錄:/usr/share/nginx/html
只需知道Nginx配置路徑腊徙,其他路徑均可在/etc/nginx/nginx.conf 以及/etc/nginx/conf.d/default.conf 中查詢到每聪。
5.Nginx常用命令
啟動(dòng):nginx
測試Nginx配置是否正確:nginx -t
優(yōu)雅重啟:nginx -s reload
查看nginx的進(jìn)程號(hào):ps -ef |grep nginx
nginx服務(wù)停止:nginx -s stop 或 kill -9 pid