我是靠谱客的博主 忧心宝马,这篇文章主要介绍腾讯云centos6.9安装nginx实践,现在分享给大家,希望可以做个参考。

腾讯云centos6.9安装nginx实践

安装步骤

复制代码
1
2
3
4
5
6
7
8
9
#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.

复制代码
1
2
3
4
5
6
[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

复制代码
1
2
3
4
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 未发现这个问题真是奇怪…

接着接续安装

复制代码
1
2
./configure --prefix=/usr/local/nginx

安装出错2.

复制代码
1
2
3
4
5
6
7
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 库 那就安装这个库

复制代码
1
2
yum -y install pcre-devel

安装完ok接着安装nginx

复制代码
1
2
./configure --prefix=/usr/local/nginx

出现问题3

复制代码
1
2
3
4
5
6
7
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库 那就咱们接着安装

复制代码
1
2
3
4
5
6
7
8
9
10
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

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
./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 过程的分享,如若哪部分书写的有问题,请评论反馈

最后

以上就是忧心宝马最近收集整理的关于腾讯云centos6.9安装nginx实践的全部内容,更多相关腾讯云centos6内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(86)

评论列表共有 0 条评论

立即
投稿
返回
顶部