腾讯云centos6.9安装nginx实践

腾讯云centos6.9安装nginx实践

安装步骤

#1.先下载tag包
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.14.2.tar.gz
#2.解压缩
tar zxvf nginx-1.14.2.tar.gz
#3.进入解压目录 配置 安装安装到/usr/local/nginx 目录上
cd nginx-1.14.2
./configure --prefix=/usr/local/nginx


安装出错1.

[root@VM-16-13-centos nginx-1.14.2]# ./configure --prefix=/usr/local/nginx
checking for OS
 + Linux 2.6.32-754.30.2.el6.x86_64 x86_64
checking for C compiler ... not found

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

没有装gcc 先yum 装下gcc

yum install gcc
#yum install 出现错误,省略了部分错误信息
Error: Cannot retrieve repository metadata (repomd.xml) for repository: rpmforge.

yum install 命令执行错误 在网上寻找答案 腾讯云默认的yum 源文件是有问题的需要去修改下
将 /etc/yum.repos.d/CentOS-Base.repo 和 /etc/yum.repos.d/CentOS-Epel.repo 中的 $releasever 替换成 6 这个6值为centos 大版本号,修改文件保存后在执行 yum install gcc 可正常执行, 腾讯云重装系统n次后yum install 未发现这个问题真是奇怪…

接着接续安装

./configure --prefix=/usr/local/nginx

安装出错2.

checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found

./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 库 那就安装这个库

yum -y install pcre-devel

安装完ok接着安装nginx

./configure --prefix=/usr/local/nginx

出现问题3

checking for PCRE JIT support ... not found
checking for zlib library ... not found

./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.

缺少 gzip库 那就咱们接着安装

cd /usr/local/src
# 下载zlib 包
wget http://www.zlib.net/zlib-1.2.11.tar.gz
#解压
tar -xzvf zlib-1.2.11.tar.gz
# 编译安装
./configure
make
make install

安装ok继续安装nginx

./configure --prefix=/usr/local/nginx

Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + 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"

  #再进行编译安装
  make && make install

总算是安装成功

这是本人安装nginx 过程的分享,如若哪部分书写的有问题,请评论反馈

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值