前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS 中 Nginx 的 安装

CentOS 中 Nginx 的 安装

作者头像
北漂的我
发布2020-03-20 11:29:20
2990
发布2020-03-20 11:29:20
举报
文章被收录于专栏:北漂的我北漂的我

1. 可以从 http://nginx.org/en/download.html 中下载 stable version 版本的 nginx

代码语言:javascript
复制
wget http://nginx.org/download/nginx-1.16.1.tar.gz

2. 解压 nginx 的安装包

代码语言:javascript
复制
tar -xzvf nginx-1.16.1.tar.gz

3. 在 nginx-1.16.1 目录下执行config命令

代码语言:javascript
复制
./configure --prefix=/home/bigdata/nginx

此过程最后可能会出现报错如下

代码语言:javascript
复制
./configure: error: C compiler cc is not found

解决方式是安装 gcc-c++

代码语言:javascript
复制
yum install gcc-c++

还可能报错如下

代码语言:javascript
复制
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

解决方法是安装 pcre-devel

代码语言:javascript
复制
yum install pcre-devel

还可能报错如下

代码语言:javascript
复制
./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.

解决方法是安装 zlib-devel

代码语言:javascript
复制
yum install zlib-devel

4. 在 nginx-1.16.1 目录下执行 make 编译

代码语言:javascript
复制
make

5. 在 nginx-1.16.1 目录下执行 make install

代码语言:javascript
复制
make install
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档