0、确保openssl版本大于1.0.2

openssl version

1、下载nginx-1.13.10

wget http://nginx.org/download/nginx-1.13.10.tar.gz
tar zxf nginx-1.13..tar.gz
cd nginx-1.13.

2、确认并安装gcc等编译组件

yum groupinstall "Development Tools"
yum install pcre* openssl* gd-devel* zlib-devel pcre-devel libpcre3 libpcre3-dev zlib1g-dev unzip git

3、配置编译参数

./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module

配置正常输出如下内容:

Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"

4、编译

make

5、安装

make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/nginx

6、nginx配置参考(server配置段)

server {
listen 443 ssl http2 default_server;
server_name _;
root /usr/local/nginx/html; ssl_certificate "/usr/local/nginx/conf/server.crt";
ssl_certificate_key "/usr/local/nginx/conf/server.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on; location /index.html {
http2_push_preload on;
http2_push /image.jpg;
} error_page 404 /404.html;
location = /40x.html {
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

7、准备证书与密钥文件(server.crt/server.key)

8、检查并重启nginx

nginx -t
nginx -s reload

9、用chrome访问配置好的页面

并在chrome地址栏输入

chrome://net-internals/#http2

可以看到对应站点的http/2的session

【参考资料】

https://www.nginx.com/blog/nginx-1-13-9-http2-server-push/

CentOS 7配置nginx-1.13.10支持http/2和Server Push的更多相关文章

  1. CentOS 7 配置 nginx php-fpm 详细教程

    CentOS 7 配置 Nginx 的步骤如下: 首先更新 yum,没有安装 yum 的自行安装 yum update 1. 安装 Nginx yum install nginx 开启 Nginx 并 ...

  2. centos下配置nginx支持php

    添加nginx 默认主页index.php vim .../etc/nginx/conf.d/default.conf location / { root   /usr/share/nginx/htm ...

  3. CentOS 中 配置 Nginx 支持 https

    一.基础设置: .yum -y update .yum -y install openssl* .cd /usr/local/nginx/conf .mkdir ./ssl .cd ./ssl # 在 ...

  4. Linux(CentOS 7)+ Nginx(1.10.2)+ Mysql(5.7.16)+ PHP(7.0.12)完整环境搭建

    首先安装Linux系统,我以虚拟机安装来做示例,先去下载 VitualBox,这是一款开源的虚拟机软件,https://www.virtualbox.org 官网地址.或者是VMware,www.vm ...

  5. CentOS 7 配置 Nginx 正向代理 http、https 最详解

    手头项目中有使用到 nginx,因为使用的三方云服务器,想上外网需要购买外网IP的,可是有些需要用到外网却不常用的主机也挂个外网IP有点浪费了,便想使用nginx的反向代理来实现多台内网服务器使用一台 ...

  6. centos 7 配置nginx

    安装nginx: curl -o  nginx.rpm http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0. ...

  7. 【CentOs】配置nginx

    参考资料:http://nginx.org/en/linux_packages.html#stable 1.添加nginx.repo 2.配置nginx 3.启动nginx 1.添加nginx.rep ...

  8. Ubuntu配置Nginx虚拟主机和支持ThinkPHP

    [Nginx配置虚拟主机] 每一个 server { listen       80;         server_name  www.a.com; ..... } 就表示一台虚拟域名, 然后对应的 ...

  9. CentOS 7 配置nginx并默认强制使用https对http进行跳转

    1.安装nginx yum install nginx 2.启动nginx服务 service nginx start 3.开启防火墙80端口,云服务器和本地虚拟服务器各有不同,不再赘述. 4.访问你 ...

随机推荐

  1. CURLOPT_RETURNTRANSFER

    curl_setopt($ch,CURLOPT_RETURNTRANSFER,);//设置返回值不直接输出,例如返回xml格式,会将xml原样输出

  2. UML 类图几种关系的总结(图文并茂、案例详解)

    听语音 | 浏览:2831 | 更新:2017-03-01 13:06 1 2 3 4 5 6 7 分步阅读 在UML类图中,常见的有以下几种关系: 泛化(Generalization),  实现(R ...

  3. R及Rstudio 的使用建议

    对于新人来说,进行R的学习时,通常会发现一般的教程都是让大家在交互环境下使用R. 但是这有一些缺点,比如在交换环境下,出现错误是难以撤销的,有的时候甚至需要重头做起.尤其是在Rstudio的交互环境下 ...

  4. SQL截取字符串分隔符中间部门的办法

    需求:实际项目中需要截取第2到第3个逗号中间部分的内容 方案: declare @str nvarchar(50);set @str='11,222,3333,44444';select @str a ...

  5. idea15 生成mybatis代码

    pom.xml <build> <finalName>mybatis_generator</finalName> <plugins> <plugi ...

  6. android udp 无法收到数据 (模拟器中)

    解决方法:1. 运行模拟器2. 打开window 命令行执行:telnet localhost 55545554是模拟器的端口,执行之后会进入android console3. 在console下执行 ...

  7. java基本例子

    文件结构 D:\jp\jarDemo\IAmMainClass.java import iAmPackage.*; public class IAmMainClass { public static ...

  8. 安装ADT和ADK到eclipse

    1.安装好JDK后,配置一下环境变量: 为了配置JDK的系统变量环境,我们需要设置三个系统变量,分别是JAVA_HOME,Path和CLASSPATH.下面是这三个变量的设置防范. JAVA_HOME ...

  9. 视频基础知识:浅谈视频会议中H.264编码标准的技术发展

    浅谈视频会议中H.264编码标准的技术发展 浅谈视频会议中H.264编码标准的技术发展 数字视频技术广泛应用于通信.计算机.广播电视等领域,带来了会议电视.可视电话及数字电视.媒体存储等一系列应用,促 ...

  10. ubuntu samba共享后windows读写文件都是以nogroup问题

    添加smb账号 sudo smbpasswd -a xxx 如果报错:Failed to add entry for user xxx 则是因为这个账号不存在 添加成功以后,过一会就可以重新登陆了(u ...