checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config

                                 解压目录执行编译参数配置./configure --prefix=/usr/local/nginx

linux版本:CentOS7 64位

在安装nginx前首先要确认系统中安装了gcc、pcre-devel、zlib-devel、openssl-devel

nginx下载地址:https://nginx.org/download/

下载“nginx-1.9.9.tar.gz”,移动到/usr/local/下。

## 解压
tar -zxvf nginx-1.9.9.tar.gz

##移动
mv nginx-1.9.9 nginx

##进入nginx目录
cd nginx

## 配置,这一步可能会出现各种的错误,在下面会一一列出。
./configure --prefix=/usr/local/nginx

 

错误信息

checking for OS
+ Linux 3.10.0-327.el7.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found

解决方法:安装gcc

yum -y install gcc

错误信息

./configure: error: the HTTP rewrite module requires the PCRE library.

解决方法:安装pcre-devel

yum install pcre-devel

错误信息

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

解决方法:安装zlib-devel

yum install zlib-devel

 

再次执行“./configure --prefix=/usr/local/nginx”

正确的结果如下:

    技术分享

OK,现在可以执行make 了。 如果你想使用openssl 功能,sha1 功能就需要安装openssl ,sha1。

yum -y install openssl openssl-devel

开启ssl 模块

./configure --with-http_ssl_module

   技术分享

执行make、make install命令

测试是否安装成功

./nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

启动nginx 

cd /usr/local/nginx/sbin
./nginx //启动nginx

在浏览器中输入服务器的ip地址,如:192.168.1.12

很不幸,打不开链接。下面进行原因排查:

    技术分享

    技术分享

说明服务器的80端口是打不开的。

因为我使用的linux系统版本是CentOS7,所以可以在服务器中执行如下命令来验证》》

firewall-cmd --query-port=80/tcp

    技术分享

显然80端口没有开启。

下面我们开启80端口:

    技术分享

刷新浏览器

    技术分享

====================== 分割线 ====================

配置完毕!

  • 11
    点赞
  • 37
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值