Linux环境离线安装Nginx

安装前先验证下版本

安装gcc

rpm -Uvh *.rpm --nodeps --force

安装g++

rpm -Uvh *.rpm --nodeps --force

验证gcc、g++是否安装成功,执行命令:

gcc -v

g++ -v

一.安装PCRE

先把pcre解压出来

tar xvf pcre-8.35.tar.gz

切换PCRE目录

cd pcre

执行以下命令

./configure

make

make install

二.安装libtool

解压libtool

tar xvf libtool-2.4.2.tar.gz

切换libtool目录

cd libtool

执行以下命令

./configure

make

make install

三.安装nginx

解压nginx

tar xvf nginx-1.13.9.tar.gz

切换nginx目录

cd nginx

执行以下命令

./configure

make

make install

安装nginx时可能会抛出异常

./configure: error: the HTTP gzip module requires the zlib library.

You can either disable the module by using –without-http_gzip_module

option, or install the zlib library into the system, or build the zlib

library

statically from the source with nginx by using –with-zlib= option.

yum install -y zlib-devel 执行对应的安装命令即可

或者上传zlib包安装命令同上边

四.常用命令

启动-c参数指定了要加载的nginx配置文件路径。

需要配置nginx.conf需要在use/local/nginx下的conf中进行配置

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

启动

/usr/local/nginx/sbin/nginx

停止

/usr/local/nginx/sbin/nginx -s stop

重启

/usr/local/nginx/sbin/nginx -s reload

查询端口

ps -ef | grep nginx

杀掉进程

kill 进程id

查看进程

netstat -nltp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值