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 查看硬 ...
随机推荐
- [日常] json_encode对中文和引号的处理差异研究
json_encode()1.默认就是把所有 ASCII 可显示字符以外的统统转义为 Unicode如果把那些字符转义为 Unicode 之后,无论文件编码是否一致,都不会出现乱码,因此中文转成Uni ...
- RequestAnimationFrame更好的实现Javascript动画
一直以来,JavaScript的动画都是通过定时器和间隔来实现的.虽然使用CSS transitions 和 animations使Web开发实现动画更加方便,但多年来以JavaScript为基础来实 ...
- 【代码笔记】iOS-cell自动变化大小
一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController ...
- spring-boot-starter-actuator不起作用
spring-boot-starter-actuator的作用,actuator是监控系统健康情况的工具.使用这个功能首先要先添加依赖,如下.<!-- 监控和管理生产环境--><de ...
- Docker for Windows(五)实践搭建SqlServer服务&执行数据库操作
上一篇我们已经搭建了一个mysql数据库服务了:Docker for Windows(四)实践搭建&删除MySQL服务,发现用Docker确实是方便且容易,但上一篇主要是服务的搭建删除等基础操 ...
- Docker for Windows(四)实践搭建&删除MySQL服务
我们已经下载安装好了Docker for Windows:Docker for Windows(一)下载与安装,也简单了解了Docker常用命令:Docker for Windows(三)Docker ...
- GIT 这么好用,为什么还是有人不知道怎么用它提交代码?
客户端代码管理工具的变迁: 从 SVN 到 GIT 截止目前,新版的 APICloud Studio 2 仍然处于公测期.APICloud Studio 2 的代码管理客户端,由 SVN 改为了 GI ...
- css类选择器类名覆盖优先级
code <style> .a{ background: red; } .b{ background: yellow; } </style> <div class=&qu ...
- 浏览器根对象document之方法概述
1.1 节点 筛选 getRootNode返回上下文的根节点. querySelector返回文档中匹配指定 CSS 选择器的第一个元素. querySelectorAll返回文档中匹配指定 CSS ...
- struts2 开发模式
在struts.xml中增加: <constant name="struts.devMode" value="true" />