一、下载源码包
复制链接打开
链接:*https://pan.baidu.com/s/17gUkX-UC9GHTf3rkY8aV_Q*
提取码:**1314**
~~~~复制这段内容后打开,操作更方便哦~~~~
二、安装nginx
[root@web01 ~]
[root@web01 ~]
[root@web01 ~]
Nginx依赖于pcre、zlib、openssl,在编译前配置时如果有问题
使用yum方式安装三个包(pcre-devel、zlib-devel、openssl-devel)
[root@web01 opt]
[root@web01 opt]
[root@web01 opt]
[root@web01 opt]
[root@web01 opt]
[root@web01 opt]
[root@web01 opt]
[root@web01 nginx ]
[root@web01 nginx ]
[root@web01 nginx ]
[root@web01 ~ ]
root 3949 0.0 0.1 46436 1152 ? Ss 4月30 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
www 3950 0.0 0.2 46836 2180 ? S 4月30 0:00 nginx: worker process
root 6295 0.0 0.0 112676 976 pts/1 S+ 03:00 0:00 grep --color=auto nginx
3查看Nginx使用的端口号
[root@web01 ~]
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3949/nginx: master
停止nginx
停止Nginx的三种方式
[root@web01 ~]
[root@web01 ~]
[root@web01 ~]
[root@web01 ~]
[root@web01 ~]
[root@web01 ~]
[root@web01 ~]
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@web01 ~]
..........
export PATH=$PATH:/usr/local/nginx/sbin
......
[root@web01 ~]
[root@web01 ~]
[root@web01 ~]
[root@web01 ~]
三、源码安装nginx,自动化安装脚本实现
NGINX_VERSION=1.12.2
NGINX_SRC_PATH=/root
NGINX_BIN_PATH=/usr/local/nginx
systemctl stop firewalld
setenforce 0
yum install -y pcre-devel zlib-devel openssl-devel wget gcc
cd ${NGINX_SRC_PATH}
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar -xzvf nginx-${NGINX_VERSION}.tar.gz
cd ./nginx-${NGINX_VERSION}
./configure --prefix=${NGINX_BIN_PATH} --with-http_ssl_module
make & make install
cd ${NGINX_BIN_PATH}/sbin
./nginx