linux下安装nginx

写在前面:虚拟机安装linux系统为Centos7 64位。

安装步骤:

第一步:官网下载安装包(.tar.gz),下载当前的稳定版 。下载地址:https://nginx.org/en/download.html

第二步:解压压缩包

执行命令:

tar -zxvf nginx-1.16.1.tar.gz

cd nginx-1.16.1

第三步:配置(默认配置)

执行命令:

./configure

第四步:编译安装

执行命令:

make

make install

查找nginx

whereis nginx

 

启动、停止nginx

cd /usr/local/nginx/sbin/
./nginx 
./nginx -s stop
./nginx -s quit
./nginx -s reload

注: ./nginx -s quit:此方式停止步骤是待nginx进程处理任务完毕进行停止。
   ./nginx -s stop:此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程。

查询nginx进程:

ps aux|grep nginx

启动成功后用浏览器访问

安装过程中遇到的问题

执行 make后报错:

make: *** No targets specified and no makefile found. Stop

解决 :记得先执行./configure再执行make命令

执行./configure报错:

./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=<path> option.

解决:yum -y install openssl openssl-devel

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值