一、下载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. pandas学习笔记(一)

    Pandas是一款开放源码的BSD许可的Python库,为Python编程语言提供了高性能,易于使用的数据结构和数据分析工具.Pandas用于广泛的领域,包括金融,经济,统计,分析等学术和商业领域.在 ...

  2. linux git 保存账号密码

    vi .git/config [credential] helper = store git pull 输入用户名.密码自动保存

  3. Windows10最新更新破坏了PowerShell功能

    Java9%E6%8E%A5%E8%BF%91%E4%BA%A4%E4%BB%98%E6%97%A5%E6%9C%9F%E5%92%8C%E8%8C%83%E5%9B%B4%E5%AE%A1%E6%9 ...

  4. 影响solr性能的一些因素(附使用经验)

    Solr本身的性能不错,但是在使用过程中,还是会遇到一些使用错误,或是没考虑到的地方:在出现瓶颈时,可以首先考虑哪些点呢?下面就来看一下Solr官方的总结,个人觉得总结的很好.SOLR+LUCENE的 ...

  5. java——collection总结

    Collection 来源于Java.util包,是非常实用常用的数据结构!!!!!字面意思就是容器.具体的继承实现关系如下图,先整体有个印象,再依次介绍各个部分的方法,注意事项,以及应用场景.   ...

  6. 从零开始学习python:demo2.5

    for 循环语句 1.单个for循环: s1 = 'Python'for s2 in s1:    print(s2) ------------------------- Python ------- ...

  7. 71.纯 CSS 创作一个跳 8 字型舞的 loader

    原文地址:https://segmentfault.com/a/1190000015534639#articleHeader0 感想:rotateX() 和rotateZ()一起使用好懵呀. HTML ...

  8. 一些最常见的SNMP的OID自动翻译成zabbix数字进行表示(华为9306)

    转载自:https://blog.51cto.com/davidbj/1173954 随着Zabbix 2.0版本的发布,很多企业开始用zabbix来代替之前的Nagio.Cacti等其它监控软件.至 ...

  9. openvpn-monitor openvpn-server的监控插件

    项目地址 https://github.com/furlongm/openvpn-monitor

  10. 魔力Python--斐波那契数列(全)

    1. 斐波那契数列应用广泛,对此数列的更好理解有助于我们算法的更进一步,并降低程序的时间复杂度,提高运行效率. 2. 斐波那契数列的应用(4种): 2.1 排列组合----经典例子:爬楼梯 " ...