# 安装nginx
1、添加源
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2、安装
yum install -y nginx
# 查看nginx所在目录
whereis nginx
# 添加&修改nginx服务文件
cd /lib/systemd/system/
vi nginx.service
修改配置文件内的nginx真实路径
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/usr/sbin/nginx -s quit
PrivateTmp=true
# 设置开机自启动
systemctl enable nginx.service
# 停止开机自启动
systemctl disable nginx.service
# 关闭nginx服务器命令
systemctl stop nginx.service
# 启动nginx服务器命令
systemctl start nginx.service