码迷,mamicode.com
首页 > 其他好文 > 详细

nginx安装,配置,卸载

时间:2019-10-17 17:16:55      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:star   安装nginx   dev   centos   自带   move   eve   load   ges   

一丶安装

1.yum 安装(自带环境变量)

# 1.Centos7中添加nginx源
>>> rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# pip 安装
>>> pip install nginx

2.源码安装

# 1.安装nginx依赖包
>>> yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
>>> yum install gcc gcc-c++ make libtool -y
# 2.创建nginxmulu
>>> cd /etc
>>> mkdir nginx
>>> cd nginx
# 3.下载nginx安装包:http://nginx.org/en/download.html
>>> wget http://nginx.org/download/nginx-1.13.7.tar.gz
>>> tar -xvf nginx-1.13.7.tar.g
# 4.安装nginx
>>> cd /etc/nginx
>>> ./configure
>>> make && make install

二丶配置nginx

# 1. 添加ngnx配置文件(yum安装)
>>> cd /etc/nginx/conf.d/
>>> t
# 2. 修改配置文件
>>> vim /etc/nginx/conf/nginx.conf

三丶nginx常用命令

# 启动
/usr/sbin/nginx
# 关闭
/usr/sbin/nginx -s stop
# 重启
/usr/sbin/nginx -s reload
# 开机自启
systemctl start nginx.service
systemctl enable nginx.service

四丶卸载nginx

1.yum安装卸载

yum remove nginx

2.源码安装卸载

# 1.查看nginx安装目录
>>> whereis nginx
nginx: /usr/sbin/nginx
# 2.删除nginx自启动
>>> chkconfig nginx off
# 3.停止nginx服务
>>> /usr/sbin/nginx -s stop
# 4.删除nginx安装目录
>>> rm -rf /etc/nginx
# 5.检查是否有残余
>>> find / -name nginx
/usr/libexec/initscripts/legacy-actions/nginx
>>> rm -ef /usr/libexec/initscripts/legacy-actions/

nginx安装,配置,卸载

标签:star   安装nginx   dev   centos   自带   move   eve   load   ges   

原文地址:https://www.cnblogs.com/bbiu/p/11693239.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!