一、下载nginx源码

http://nginx.org/en/download.html

如:nginx-1.16.0.tar.gz

二、创建用户和组,并解压

groupadd www
useradd -g www www
tar xf nginx-1.16.0.tar.gz

  

三、下载openssl,编译高版本openssl

https://www.openssl.org/source/

如:openssl-1.0.2r.tar.gz

tar xf openssl-1.0.2r.tar.gz

  

四、编译安装nginx

cd nginx-1.16.0

./configure --prefix=/data/nmp/nginx \
--user=www \
--group=www \
--with-pcre \
--with-openssl=/data/openssl-1.0.2r \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-http_image_filter_module \
--with-http_slice_module \
--with-mail \
--with-threads \
--with-file-aio \
--with-stream \
--with-mail_ssl_module \
--with-stream_ssl_module \

--with-openssl 的路径设置为第3步中openssl源码解压路径。

上面的有些模块大家可以按需安装。

make -j8 && make install

  

五、配置systemd服务

创建 nginx.service 文件

vi /usr/lib/systemd/system/nginx.service

[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target [Service]
Type=forking
ExecStartPre=/data/nmp/nginx/sbin/nginx -t
ExecStart=/data/nmp/nginx/sbin/nginx -c /data/nmp/nginx/conf/nginx.conf
ExecReload=/data/nmp/nginx/sbin/nginx -s reload
ExecStop=/data/nmp/nginx/sbin/nginx -s stop
PrivateTmp=true [Install]
WantedBy=multi-user.target

启用 nginx.service

systemctl enable nginx.service

启动 nginx

systemctl start nginx.service

  

六、设置firewalld防火墙,开放80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

  

centos7下编译安装nginx-1.16.0的更多相关文章

  1. CentOS 6.5 下编译安装 Nginx 1.8.0

    转自:https://i.cnblogs.com/EditPosts.aspx?postid=8303227&update=1 安装编译依赖的包 yum -y install gcc gcc- ...

  2. Centos7下编译安装php扩展redis5.0.2

    安装环境:centos7 + php 7.2.191. 下载地址:http://pecl.php.net/get/redis-5.0.2.tgz .tgz http://pecl.php.net/ge ...

  3. centos7下编译安装php-7.0.15(PHP-FPM)

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

  4. CentOS7下编译安装redis-5.0.9

    CentOS7下编译安装redis-5.0.9 本文地址http://yangjianyong.cn/?p=171转载无需经过作者本人授权 下载redis #code start wget https ...

  5. ubuntu14.04下编译安装ambari-2.4.2.0

    ubuntu14.04下编译安装ambari-2.4.2.0 编译前的准备工作 准备工作有: 系统参数 系统依赖(编译环境) 离线安装包 java环境 maven环境 Nodejs环境 git环境 a ...

  6. Ubuntu 16.04源码编译安装nginx 1.10.0

    一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...

  7. 在CentOS 7下编译安装Nginx+PHP+MySQL环境

    本文转载自:http://www.softeng.cn/?p=156,本文已获得作者授权,未经作者同意,不可转载. 1.前言 本文适合于已经对Linux操作系统具有基本操作经验,并且能够在Linux或 ...

  8. linux下编译安装nginx

    1.首先下载稳定版nginx1.10.2 使用wget命令下载 wget http://nginx.org/download/nginx-1.10.2.tar.gz 2.然后解压 tar -zxvf  ...

  9. centos7 下 yum 安装Nginx

    centos7 下 yum 安装和配置 Nginx 添加yum源 Nginx不在默认的yum源中,可以使用epel或者官网的yum源,这里使用官网的yum源 rpm -ivh http://nginx ...

随机推荐

  1. ubuntu16.04上安装ros-kinetic

    1.设置安装源 sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" ...

  2. C语言排序算法学习笔记——插入类排序

    排序就是讲原本无序的序列重新排序成有序的序列.序列里可以是一个单独数据,也可以是多个数据组合的记录,按照记录里的主关键字或者次关键字进行排序. 排序的稳定性:如果排序表中有两个元素R1,R2,其对应的 ...

  3. SUID、SGID详解

    文章转载至:http://tech.ccidnet.com/art/2583/20071030/1258885_1.html 如果你对SUID.SGID仍有迷惑可以好好参考一下! Copyright ...

  4. 小程序2-基本架构讲解(一)WXML 模板

    项目里边生成了不同类型的文件: .json 后缀的 JSON 配置文件 .wxml 后缀的 WXML 模板文件 .wxss 后缀的 WXSS 样式文件 .js 后缀的 JS 脚本逻辑文件 WXML 模 ...

  5. spring suite tool 添加namespace时只有bean一个

    在eclipse的windows->Preferences->Spring->Beans Support->Namespaces 在此记录此问题.

  6. (17/24) webpack实战技巧:生产环境和开发环境并行设置,实现来回切换

    1. 概述 生产环境和开发环境所需依赖是不同: --开发依赖:就是开发中用到而发布时用不到的.在package.json里面对应的就是devDependencies下面相关配置. --生产依赖: 就是 ...

  7. java idea 代码规范插件

    推荐阿里的 p3c https://github.com/alibaba/p3c

  8. Zabbix常见问题

    1.Q:  agent日志中出现“active check configuration update from [127.0.0.1:10051] started to fail (cannot co ...

  9. 11Linux_sshd_Apache

    1.Linux系统中一切都是文件. 2.配置服务实际上就是在修改配置文件. 3.重启相应服务来加载最新的配置参数. 4.为了保证下次还生效,加入到开机启动项中.

  10. 深度学习原理与框架- batch_normalize(归一化操作)

    1. batch_normalize(归一化操作),公式:传统的归一化公式 (number - mean) / std, mean表示均值, std表示标准差 而此时的公式是 scale * (num ...