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相关路径
whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz
以下是Nginx的默认路径:
(1) Nginx配置路径:/etc/nginx/
(2) PID目录:/var/run/nginx.pid
(3) 错误日志:/var/log/nginx/error.log
(4) 访问日志:/var/log/nginx/access.log
(5) 默认站点目录:/usr/share/nginx/html
只需知道Nginx配置路径,其他路径均可在/etc/nginx/nginx.conf 以及/etc/nginx/conf.d/default.conf 中查询到。
5.Nginx常用命令
启动:nginx
测试Nginx配置是否正确:nginx -t
优雅重启:nginx -s reload
查看nginx的进程号:ps -ef |grep nginx
nginx服务停止:nginx -s stop 或 kill -9 pid
网友评论