CentOs7.2编译安装Nginx服务器
1. 安装nginx依赖
首先安装nginx的依赖
yum install gcc gcc-c++ openssl openssl-devel cyrus-sasl-md5
2,创建nginx用户
如果没有nginx,启动nginx时会报错
[root@localhost nginx-1.11.]# /usr/local/nginx/sbin/nginx
nginx: [emerg] getpwnam("nginx") failed
groupadd nginx
useradd -s /sbin/nologin -g nigix -M nginx
3,下载最新版nginx安装包
wget -C http://nginx.org/download/nginx-1.12.0.tar.gz
4,解压
tar zxvf nginx-1.12..tar.gz
5,进入nginx目录
cd nginx-1.12.
6,编译设置
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module
因此要顺利的通过nginx编译安装必须安装的依赖关系有:
yum install gc gcc gcc-c++ pcre-devel zlib-devel openssl-devel
如果有错误提示:./configure: error: C compiler cc is not found
解决方法:
yum install gcc gcc-c++
如果有错误提示:./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.
解决方法:
yum install pcre-devel
如果有错误提示:./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using –with-openssl=<path> option.
解决方法:
yum install openssl-devel
7,编译&安装
make & make install
8,nginx直接启动方法
/usr/local/nginx/sbin/nginx
9,现在我们将nginx加入到环境变量中
vi /etc/profile

随后我们更新环境变量 并使用命令再次重启nginx
写在结尾:可能会出现没有pid文件的情况
[emerg]: getpwnam(“nginx”) failed
|
1
2
|
[root@localhost nginx-1.11.2]# /usr/local/nginx/sbin/nginxnginx: [emerg] getpwnam("nginx") failed |
CentOs7.2编译安装Nginx服务器的更多相关文章
- Windows 编译安装 nginx 服务器 + rtmp 模块
有关博客: <Windows 编译安装 nginx 服务器 + rtmp 模块>.<Ubuntu 编译安装 nginx>.<Arm-Linux 移植 Nginx> ...
- linux软件管理之------编译安装nginx服务器并手动编写自动化运行脚本
红帽系列的 linux软件管理分为三类:1. rpm 安装软件.2. yum 安装软件.3. 源码包编译安装.前面两种会在相关专题给出详细讲解.源码包的编译安装是非常关键的,我们知道linux的相关版 ...
- CentOS7.6编译安装nginx
配置阿里云yum源 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget -O /etc/yu ...
- centos7下快速安装Nginx服务器
1.添加源 默认情况Centos7中无Nginx的源,最近发现Nginx官网提供了Centos的源地址.因此可以如下执行命令添加源: sudo rpm -Uvh http://nginx.org/pa ...
- CentOS7.3编译安装Nginx设置开机启动
起因 最近想玩nginx了,本来用yum -y install nginx安装也启动好了,但是买了本<Nginx高性能Web服务器详解>,我咋能辜负我的书费呢?于是我就直接ps -ef | ...
- 在centos7上编译安装nginx
题前,先放一个有图有真相的博客链接:https://www.cnblogs.com/zhang-shijie/p/5294162.html 虽然别人说的很详细,但还是记录一下 1.VMWare Wor ...
- CentOS7.x编译安装nginx,实现HTTP2
网站使用HTTP2有助于网站加速及更安全,要配置HTTP2必须满足两个条件:①openssl的版本必须在1.0.2e及以上.②nginx的版本必须在1.9.5以上 一.准备工作 配置HTTP2之前需 ...
- Ubuntu 编译安装 nginx
有关博客: <Windows 编译安装 nginx 服务器 + rtmp 模块>.<Ubuntu 编译安装 nginx>.<Arm-Linux 移植 Nginx> ...
- Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Mariadb 10.1.20 + Nginx 1.10.2 + PHP 7.1.0 + Laravel 5.3 )
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...
随机推荐
- C#基础笔记(第十三天)
1.复习泛型集合List<T>Dictionary<Tkey,Tvalue>装箱和拆箱装箱:把值类型转换为引用类型拆箱:把引用类型转换为值类型 我们应该尽量避免在代码中发生装箱 ...
- 【学习笔记】--- 老男孩学Python,day12 函数名的应用,闭包,迭代器
1, 函数名的应用,第一类对象 函数名可以像变量一样进行使用 1.赋值 def func(): print("你吃了么?") # print(func) # a = func # ...
- NodeJs -- express 快速建站
直接上干货 1.新建一个目录来存放我们即将要做的东西: 2.win+R打开小黑框:进入到我们的目录下: 3.首先我们要全局安装Express框架:**在这一步之前要确保你本机上安装了node:** n ...
- 当div元素内的内容超出其宽度时,自动隐藏超出的内容
word-break:keep-all;/* 不换行 */ white-space:nowrap;/* 不换行 */ overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */ te ...
- 前端AMD、CMD和commonJs-前端知识
前端AMD和CMD是在模块化的基础上产生并且得到大幅度的引用的. AMD 即Asynchronous Module Definition(点击链接可以查看AMD面试题),中文名是异步模块定义的意思.它 ...
- TextBlock 重写,当文本过长时,自动截断文本并出现Tooltip
如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Syst ...
- 2017 先知创新大会:有 ZHI 而来
先知创新大会( XIANZHI INNOVATION CONFERENCE ) 是聚焦安全行业创新的行业盛事, 旨在推动安全技术的进步和发展. 先知大会的主题是“极致·眼界·创新” 极致:追求技术的极 ...
- eventbus3-intellij-plugin插件搜不到
一.eventbus3-intellij-plugin插件搜不到
- syscall to rop
前言 hitcon 2017 的 start 题,比较简单,练练手. 题目链接: https://gitee.com/hac425/blog_data/tree/master/hitcon2017 正 ...
- linux 文件搜索命令find、-name、-iname、通配符*?、-size、-user、-group、-amin、-cmin、-mmin、-a、-o、-exec/-ok、-inum
尽可能规划好目录结构,少用文件搜索操作,因为它会占用大量的系统资源 find /bin/find find [搜索范围] [匹配条件] find /etc -name initfind /etc -n ...