赞
踩
1.centos7系统
清华大学开源镜像站:https://mirrors.tuna.tsinghua.edu.cn/
阿里云镜像站:https://developer.aliyun.com/mirror/
[root@nginx-server ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
2.nginx安装包准备
nginx官网:http://nginx.org/
[root@nginx-server ~]# ls lnmp_soft/nginx-1.*
lnmp_soft/nginx-1.16.1.tar.gz
lnmp_soft/nginx-1.17.6.tar.gz
3.清空防火墙配置、关闭selinux
[root@nginx-server ~]# iptables -F
[root@nginx-server ~]# setenforce 0
1.安装nginx依赖包
[root@nginx-server ~]# yum -y install gcc pcre-devel openssl-devel
2.解压nginx包
[root@nginx-server lnmp_soft]# tar -xf nginx-1.16.1.tar.gz
[root@nginx-server lnmp_soft]# cd nginx-1.16.1/
[root@nginx-server nginx-1.16.1]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src
3.编译、安装nginx
注意:一定要在安装包内编译安装
[root@nginx-server nginx-1.16.1]# ./configure \
--prefix=/usr/local/nginx \ #指定安装目录
--user=nginx \ #指定账户名称
--group=nginx \ #指定组名称
--with-http_ssl_module #支持加密功能
[root@nginx-server nginx-1.16.1]# make && make install
4.启动nginx
[root@nginx-server ~]# /usr/local/nginx/sbin/nginx
[root@nginx-server ~]# ps aux | grep nginx
root 13948 0.0 0.0 45968 3260 ? S 14:57 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody 13949 0.0 0.0 46412 1876 ? S 14:57 0:00 nginx: worker process
root 14043 0.0 0.0 112808 968 pts/0 S+ 15:17 0:00 grep --color=auto nginx
[root@nginx-server ~]# ss -tanulp | grep nginx
tcp LISTEN 0 128 *:80 *:* users:(("nginx",pid=13949,fd=6),("nginx",pid=13948,fd=6))
[root@nginx-server ~]# /usr/local/nginx/sbin/nginx -V #查看版本
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --with-http_ssl_module
1.解压软件包
[root@nginx-server lnmp_soft]# tar -xf nginx-1.17.6.tar.gz
[root@nginx-server lnmp_soft]# cd nginx-1.17.6/
[root@nginx-server nginx-1.17.6]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src
2.升级nginx
注意:一定要在安装包内编译
[root@nginx-server nginx-1.17.6]# ./configure --with-http_ssl_module
[root@nginx-server nginx-1.17.6]# make
[root@nginx-server nginx-1.17.6]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
[root@nginx-server nginx-1.17.6]# cp objs/nginx /usr/local/nginx/sbin/
[root@nginx-server nginx-1.17.6]# make upgrade
[root@nginx-server ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.17.6
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --with-http_ssl_module
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。