docker exec -it centos7 bash
安装准备
yum -y install gcc
yum -y install gcc-c++
yum -y install make
yum -y install pcre pcre-devel # perl 兼容的正则表达式库
yum -y install zlib zlib-devel #网页压缩
yum -y install openssl openssl-devel #安全套接字层密码库
yum 安装
yum install nginx -y
安装包安装
下载安装包
wget 如无命令 使用 yum install wget 安装
wget http://nginx.org/download/nginx-1.16.1.tar.gz
解压安装包
tar -zxvf nginx-1.16.1.tar.gz
cd nginx-1.16.1.tar.gz
编译安装
./configure --prefix=/usr/local/nginx --with-http_ssl_module
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
运行nginx
启动nginx
nginx
停止nginx
Nginx -s stop
重启nginx
Nginx -s reload
Nginx 更新或安装插件
查看ningx配置
Nginx -V
编译新安装文件
Cd nginx-1.16.1.tar.gz
./configure --prefix=/usr/local/nginx --with-http_ssl_module
这里不要 && make install 只做编译
Make
替换nginx执行文件
/usr/local/nginx/sbin
mv nginx nginx.bak
cp objs/nginx /usr/local/nginx/sbin/
Nginx -V
Nginx -s reload
Nginx 卸载
找到nginx文件目录
whereis nginx
停止nginx
nginx -s stop
删除nginx文件
rm -rf /usr/local/nginx
rm -rf /usr/bin/nginx
更新环境变量配置
Source /etc/profile
测试
Nginx