linux-Ngix下载-安装

本文详细介绍如何通过wget下载并安装openssl、zlib、pcre等依赖库,以及如何使用这些库来配置和安装Nginx。此外还提供了检查安装是否成功的方法、Nginx的常用命令以及如何启动、停止和查看Nginx版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

工具包下载

wget http://www.openssl.org/source/openssl-fips-2.0.2.tar.gz
wget http://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.35.tar.gz
wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
wget http://prdownloads.sourceforge.net/libpng/zlib-1.2.8.tar.gz
wget http://nginx.org/download/nginx-1.7.2.tar.gz

解压及配置命令

1.安装openssl-fips-2.0.2.tar.gz

[root@localhost mrms]# tar -zxvf openssl-fips-2.0.2.tar.gz 

[root@localhost mrms]# cd openssl-fips-2.0.2

[root@localhost openssl-fips-2.0.2]# ./config 

[root@localhost openssl-fips-2.0.2]# make

[root@localhost openssl-fips-2.0.2]# make install

2.安装zlib-1.2.8.tar.gz

[root@localhost mrms]# tar -zxvf zlib-1.2.8.tar.gz

[root@localhost mrms]# cd zlib-1.2.8

[root@localhost zlib-1.2.7]# ./configure 

[root@localhost zlib-1.2.7]# make

[root@localhost zlib-1.2.7]# make install

3.安装pcre-8.35.tar.gz

[root@localhost mrms]# tar -zxvf pcre-8.35.tar.gz

[root@localhost mrms]# cd pcre-8.35

[root@localhost pcre-8.21]# ./configure 

[root@localhost pcre-8.21]# make

[root@localhost pcre-8.21]# make install

4.安装 nginx-1.7.2.tar.gz

[root@localhost mrms]# tar -zxvf nginx-1.7.2.tar.gz 

[root@localhost mrms]# cd nginx-1.7.2

[root@localhost nginx-1.2.6]# ./configure --with-pcre=../pcre-8.35 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-fips-2.0.2

[root@localhost nginx-1.2.6]# make

[root@localhost nginx-1.2.6]# make install

检查是否安装成功

[root@localhost nginx-1.2.6]# cd /usr/local/nginx/sbin
[root@localhost sbin]# ./nginx -t 

出现如下所示提示,表示安装成功
这里写图片描述

启动nginx

[root@localhost sbin]# ./nginx 

查看端口

[root@localhost sbin]# netstat -ntlp 

结果如下
这里写图片描述
nginx常用命令
查看nginx 进程

ps -ef|grep nginx

启动nginx

[root@iZ2ze9wsbomxf6nnmj03e0Z sbin]# ./nginx

强行杀死nginx

[root@iZ2ze9wsbomxf6nnmj03e0Z sbin]# pkill -9 nginx

停止nginx

[root@iZ2ze9wsbomxf6nnmj03e0Z sbin]# ./nginx -s stop

查看nginx版本

[root@iZ2ze9wsbomxf6nnmj03e0Z sbin]# ./nginx -v

检查配置文件是否正确

[root@iZ2ze9wsbomxf6nnmj03e0Z sbin]# ./nginx -t
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值