安装Nginx报错:make: *** 没有规则可以创建“default”需要的目标“build”。 停止。

在源码安装Nginx时,出现以下错误信息:

[root@localhost nginx-1.16.1]# make && make install
make: *** 没有规则可以创建“default”需要的目标“build”。 停止。

Nginx所需依赖包:

gcc

功能:预处理、编译、连接、汇编

openssl

功能:用于网站加密通讯。

pcre

功能:用于支持解析正则表达式。

zlib

功能:用于对数据进行解压缩。网站之间通信时,数据先压缩再传输,通过消耗CPU的方式来节省网络带宽。

安装Nginx相关依赖包:

[root@localhost nginx-1.16.1]# yum -y install gcc openssl openssl-devel pcre-devel zlib zlib-devel

安装后验证:

[root@localhost nginx-1.16.1]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module
...
Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
  
  [root@localhost nginx-1.16.1]# make && make install   //编译和安装
  ...
  test -d '/usr/local/nginx/logs' \
	|| mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/logs' \
	|| mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' \
	|| cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' \
	|| mkdir -p '/usr/local/nginx/logs'
make[1]: 离开目录“/root/nginx-1.16.1”

启动Nginx

[root@localhost nginx-1.16.1]# /usr/local/nginx/sbin/nginx
[root@localhost nginx-1.16.1]# ss -antulp | grep :80
tcp    LISTEN     0      128       *:80                    *:*                   users:(("nginx",pid=15686,fd=6),("nginx",pid=15685,fd=6))
tcp    LISTEN     0      50       :::8080                 :::*                   users:(("java",pid=3207,fd=161))

其他:

  • 如果这个方法还是不行,可以检查 ./configure后面的选项是否有误,或者选项中的路径是 否正确,也可以看一下系统提示哪些是 —not found的,看缺少哪些依赖包。

↓↓↓↓↓↓

最近刚申请了个微信公众号,上面也会分享一些运维知识,大家点点发财手关注一波,感谢大家。 【原创公众号】:非著名运维 【福利】:公众号回复 “资料” 送运维自学资料大礼包哦!
在这里插入图片描述

如果你觉得这篇文章还不错,就请动动你的发财手为本文留个言点个在看,或者转发一下吧,因为这将是我持续输出更多优质文章的最强动力

  • 13
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

非著名运维

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值