1、CentOS7
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
|
# 启动服务 systemctl start nginx
# 停止服务 systemctl stop nginx
# 重启服务 systemctl restart nginx
# 服务状态 systemctl status nginx
# 开机启动 systemctl enable nginx
# 重载服务配置 systemctl daemon-reload
|
默认配置文件路径:
配置文件:/etc/nginx/
日志文件:/var/log/nginx
服务启动脚本:/usr/lib/systemd/system/nginx.service
vim /etc/nginx/nginx.conf
|
# 停止服务 systemctl stop nginx
# 删除安装的包 yum erase $(rpm -qa | grep nginx)
# 删除配置文件 rm -rf /etc/nginx/
# 删除日志文件 rm -rf /var/log/nginx
|
2、Ubuntu16.04
sudo apt-get install nginx
|