Nginx之解压编译安装-yellowcong
来源:互联网 发布:免费超市播音软件 编辑:程序博客网 时间:2024/05/21 22:46
Nginx的安装方法有两种,一种是rpm安装 方式,另一种是解压安装的方式,第一种方法比较的简单,第二种相对折腾一点,我在第二种安装方式中,编译Nginx出错./configure: error: C compiler cc is not found,
同时还有,checking for PCRE library … not found,还有导致的原因是没有编译工具
安装前准备
对于nginx编译安装需要先安装编译 的工具,然后再安装nginx依赖
yum -y install gcc gcc-c++ autoconf automake make yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
下载nginx
#管网镜像http://nginx.org/download/#获取nginx,官方地址wget http://nginx.org/download/nginx-1.10.1.tar.gzwget http://nginx.org/download/nginx-1.6.2.tar.gz#这个是我自己七牛的服务器wget http://yellowcong.qiniudn.com/nginx-1.10.1.tar.gz#解压 /usr/local/nginx 目录tar -zxvf nginx-1.10.1.tar.gz
安装nginx
第一步是配置,第二步是编译安装
配置nginx
#进入到nginx-1.10.1 ,并配置nginxcd nginx-1.10.1 #配置nginx#--prefix 指定安装的目录#/usr/local/nginx 是安装目录,不能和自己下载的文件目录重了./configure --prefix=/usr/local/nginx
到nginx的目录下,然后配置nginx
看到了结果,就差不多 代表成功了
编译安装
只要出现上面的,差不多就是完事了,可以编译了,如果还是有错误,可以使用yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
命令,安装所有依赖
#编译安装make && make install
安装成功
安装成功后,会在./configure --prefix=/usr/local/nginx
,指定的目录/usr/local/nginx
创建4个 文件夹。具体功能下面有介绍。
#启动 nginx服务/usr/local/nginx/sbin/nginx#停止服务/usr/local/nginx/sbin/nginx -s stop#重启服务/usr/local/nginx/sbin/nginx -s reload #查看启动情况ps -ef|grep nginx#查看是否启动成功curl 192.168.100.10#查看端口情况netstat -ano|grep 80
nginx正常运行
网页访问正常
查看端口情况
目录结构
错误合集
1、./configure: error: C compiler cc is not found
错误消息
[root@1088d470c710 nginx-1.10.1]# ./configurechecking for OS + Linux 3.10.0-514.26.2.el7.x86_64 x86_64checking for C compiler ... not found./configure: error: C compiler cc is not found
解决办法
安装编译工具
[root@1088d470c710 nginx-1.10.1]# yum -y install gcc gcc-c++ autoconf automake make
然后再次编译,可以了,然而又遇到了新问题
2、checking for PCRE library … not found
pcre没有发现的问题,需要安装pcre ,他作用是让ngnix支持rewrite功能
checking for PCRE library ... not foundchecking for PCRE library in /usr/local/ ... not foundchecking for PCRE library in /usr/include/pcre/ ... not foundchecking for PCRE library in /usr/pkg/ ... not foundchecking 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_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option.
3、安装pcre
我打算安装的,结果发现这鸡毛已经安装过了,然后我需要在./configure的时候指定目录./configure --with-pcre=./auto/lib/pcre
[root@1088d470c710 nginx-1.10.1]# yum install pcreLoaded plugins: fastestmirror, ovlLoading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.comPackage pcre-8.32-15.el7_2.1.x86_64 already installed and latest version
简单说一下centos如何查找文件
#查找文件,需要获取pcre的安装位置find -name pcre
4、安装zlib
还缺少zlib library信息,感觉编译nginx是一个错误,直接使用rpm安装包多爽,安装zlib吧,别说别的了
yum -y install make zlib zlib-devel gcc-c++ libtool
错误信息
./configure: error: the HTTP gzip module requires the zlib library.You can either disable the module by using --without-http_gzip_moduleoption, or install the zlib library into the system, or build the zlib librarystatically from the source with nginx by using --with-zlib=<path> option.
5、cp: “conf/koi-win” 与”/usr/local/nginx/nginx-1.6.2/conf/koi-win” 为同一文件
文件为同一个文件的问题
cp: "conf/koi-win" 与"/usr/local/nginx/nginx-1.6.2/conf/koi-win" 为同一文件make[1]: *** [install] 错误 1make[1]: 离开目录“/usr/local/nginx/nginx-1.6.2”make: *** [install] 错误 2
- Nginx之解压编译安装-yellowcong
- Nginx之rpm安装-yellowcong
- FastDFS之nginx-module安装-yellowcong
- Nginx之日志拆分-yellowcong
- GitLab之安装-yellowcong
- Kubernate之安装-yellowcong
- Centos之RAR文件解压-yellowcong
- CentOS之Mysql安装-yellowcong
- CentOS之Java安装-yellowcong
- docker之ifconfig安装-yellowcong
- Centos7之Maven安装-yellowcong
- Redis之单机安装-yellowcong
- Redis之集群安装-yellowcong
- VMware之EXSI安装-yellowcong
- Solr之集群安装-yellowcong
- Solr之单机安装-yellowcong
- Centos之Keepalived安装-yellowcong
- Nginx之简单使用及配置-yellowcong
- 二分套二分
- Redis中sentinel集群的搭建和Jedis测试 图文教程[三]
- Mysql运行sql文件报2013错误的原因及解决办法
- ClassLoader 原理
- 工欲善其事必先利其器之熟悉 Xcode 的使用
- Nginx之解压编译安装-yellowcong
- 剑指offer 之 树的子结构
- 2015多校第九场 HDU 5400 Arithmetic Sequence 数学
- Servlet生命周期
- MySQL删除重复记录的方法
- Java迭代器模式
- 关于stm32的串口
- WHUST 2017 Div.2 Day 9 [2017-07-29]
- 数据库锁机制