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 查看硬 ...
随机推荐
- 撩课-Web大前端每天5道面试题-Day25
1.web前端开发,如何提高页面性能优化? 内容方面: .减少 HTTP 请求 (Make Fewer HTTP Requests) .减少 DOM 元素数量 (Reduce the Number o ...
- WebApiTestHelpPage
这是个什么鬼,第一次见到的时候,我也不知道就花几天时间看了下它的代码 在网上搜索WebApiTestHelpPage会出来很多相关页面 但是它们都是介绍怎么用的,要么就是怎么添加注释 它是怎么 ...
- Ubuntu双系统环境下隐藏掉其他开机启动项
系统环境:ubuntu16.04需求:PC装的双系统(ubuntu+win10),为了应对某些需求,需要将win10系统给从电脑上消失,让你看不见也进不去它.做法:当然不可能真的删除掉win10系统, ...
- 浏览器从输入到输出的过程与原理三之DNS
1. DNS 在互联网上的每一个计算机都拥有一个唯一的地址,称作“IP地址”(即互联网协议地址).由于IP地址(为一串数字)不方便记忆,DNS允许用户使用一串常见的字母(即“域名”)取代.比如,您只需 ...
- c# axPageLayoutControl 加数据框
private void axPageLayoutControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IPageLayoutControl ...
- PM、oSE、oMDE、oTSE、oTC角色职责
- Ubuntu 添加删除用户 How to Add and Delete Users on Ubuntu 16.04
Introduction One of the most basic tasks that you should know how to do on a fresh Linux server is ...
- WEBserver 性能测试
本地实验(Centos7),WEBserver性能测试; 软件包地址 wget http://download.joedog.org/siege/siege-4.0.2.tar.gztar -xf s ...
- 无锁HashMap的原理与实现
转载自: http://coolshell.cn/articles/9703.html 在<疫苗:Java HashMap的死循环>中,我们看到,java.util.HashMap并不能直 ...
- Linux 查看双节点是否做了SSH信任
perl $AD_TOP/patch/115/bin/txkRunSSHSetup.pl verifyssh -contextfile=$CONTEXT_FILE -hosts=erpapp1,erp ...