cent7配置nginx(一),nginx编译安装
来源:互联网 发布:jquery数组push对象 编辑:程序博客网 时间:2024/06/01 08:01
说明:本文章内容已经在CentOS Linux release 7.3.1611 (Core)上测试通过。
访问nginx官网下载适合的nginx版本,使用tar命令解压,进入解压目录执行
./configure
在centos7.3执行上面命令会出现如下错误,
错误内容1:
./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.
解决方法:
yum -y install pcre-devel
错误内容2:
./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.
解决方法:
yum install -y zlib-devel
错误内容23
./configure: error: C compiler cc is not found
解决方法:
yum install gcc
接着执行
./configuremakemake install
安装便可成功。
进入/usr/local/nginx/sbin执行./nginx可以启动nginx,执行netstat -nlp可以看到80端口已经被监听,在浏览器输入http://127.0.0.1可以看到Welcome to nginx!表示nginx已经启动成功。
nginx环境变量配置
每次操作nginx都需要进入/usr/local/nginx/sbin目录中,过于繁琐,因此可以在通过配置nginx环境变量解决,如下配置,执行
vim /etc/profile
打开环境配置文件,
HGINX_HOME=/usr/local/nginx/sbinPATH=$PATH:$HGINX_HOME:export PATH
修改好以后,执行source /etc/profile是配置生效。
最后附上安装nginx必备的所有的库,如果在编译安装nginx报错的情况下请检查如下库
yum install gcc yum install gcc-c++yum install pcre pcre-develyum install zlib zlib-develyum install openssl openssl-devel
nginx常用命令参考:http://www.jb51.net/article/47750.htm
阅读全文
0 0
- cent7配置nginx(一),nginx编译安装
- cent7配置nginx(一),nginx基础安装
- cent7配置nginx(二),nginx负载均衡的5种策略
- nginx安装配置(一)
- nginx 学习笔记(一)nginx 编译安装
- Nginx笔记(一)----Centos7编译安装Nginx
- nginx(二) nginx编译安装 及 配置WEB服务
- Nginx学习笔记(一):nginx的安装和配置
- nginx 编译安装与配置
- Nginx的安装与配置(一)
- Mac安装Nginx、配置PHP(一)
- nginx配置(一)
- nginx 安装 (一)
- nginx编译安装与配置-配置篇
- nginx学习(一)nginx安装
- Nginx系列(一.安装nginx)
- 初识Nginx(一):nginx的安装
- centos 下编译安装nginx + php 配置nginx+php-fpm
- Git经常使用的命令,也就那么几个
- HTML5 离线缓存详解(转)
- C/C++ BMP(24位真彩色)图像处理(1)------图像の打开与数据区处理
- 两种简单的html5
- 编译安装 因内存不够 报错 以mysql为例
- cent7配置nginx(一),nginx编译安装
- 注解(Annotation)自定义注解入门
- MVC/MVP/MVVM 三种设计模式 汇总
- Spring MVC之@RequestParam @RequestBody @RequestHeader 等详解
- linux安装apache/mysql/php的最新完整方法(cents和ubuntu都实用)
- Caffe:python版本Faster R-CNN测试
- C/C++ BMP(24位真彩色)图像处理(2)------图像の截取
- 游戏sdk接入教程:360渠道SDK接入
- 将博客搬至51CTO