一、下载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. Windows下搭建Python虚拟环境

    一.安装使用 virtualenv 1. 安装 virtualenv pip install virtualenv 2. 新建虚拟环境 virtualenv env1 用 Python3 创建虚拟环境 ...

  2. Android CheckBox修改大小、边框颜色,以及自定义CheckBox;

    CheckBox修改大小: android:scaleX="0.8" android:scaleY="0.8" CheckBox修改边框颜色,注意不是背景色: ...

  3. DocKer 创建容器 镜像端口映射失败

    问题一: 我想使用同一个镜像创建多个容器,并映射端口出现以下错误,该怎么解决? docker: Error response from daemon: driver failed programmin ...

  4. yml文件搞一波

    引用https://www.cnblogs.com/zslli/p/8717483.html https://www.cnblogs.com/baoyi/p/SpringBoot_YML.html 划 ...

  5. mysql下载和安装

    官网下载地址:https://dev.mysql.com/downloads/mysql/ 安装: 1.将下载文件解压到指定文件目录 2.再mysql目录下新建my.ini文件 [mysqld] # ...

  6. Javascript面向对象编程(二)

    子承父业 该方法利用了call,apply,按照原有的方式进行复制,做一些改进,最后进行事务处理.废话不多说,直接看例子. 在这里我提一下,call和apply的异同:它们两个都可以改变this指向, ...

  7. 灰熊:在这6个信息流和DSP平台投放后,我总结了这些血泪经验!

    笔者有幸参与公司的一款重度游戏的推广,推广以来市面上主流的信息流和DSP 平台都投过一番,今天就零零碎碎地讲讲各个平台的特点以及用户质量. 需要提前说明的是,文章的观点仅限于各个平台的 iOS 流量, ...

  8. 初次接触Linux

    最近由于工作需求,需要接触Linux系统. 使用VMware虚拟机,安装ubuntu系统.网上教程很多. 配置opencv环境.这是我参考的网上帖子https://blog.csdn.net/fish ...

  9. Jmeter学习记录

    JSON正则表达式提取规则 https://www.cnblogs.com/hc1020/p/7723720.html Jmeter非GUI下执行日志 执行命令 ./jmeter  -n  -t  $ ...

  10. Winform 中写代码布局中遇到的控件遮盖问题

    在winform中编程时,需要动态向主窗体中增加菜单栏和用户控件,菜单栏需要设置DockStyle为Top ,而设置用户控件的DockStyle为Fill,之后在加载的时候,出现了菜单栏遮盖用户控件的 ...