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. mcu 通信数据解析

    串口发送一帧数据时,两个字节的间隔时间是多少? 波特率:发送二进制数据位的速率,习惯上用 baud 表示,即我们发送一位二进制数据的持续时间=1/baud. 如果波特率为9600,发送一个位需要的时间 ...

  2. 无法嵌入互操作类型"ESRI.ArcGIS.Carto.MapDocumentClass".请改用适用的接口

    在对地图文档进行操作时,居然出现如下问题: IMapDocument m_MapDocument = new ESRI.ArcGIS.Carto.MapDocumentClass(); 报错: 无法嵌 ...

  3. apicloud模块开发知识点

    1. 没有加模块的时候dex里面的包 \android\support\annotation \android\support\v4 \com\uzmap\pkg \compile 2. 不能混淆的类 ...

  4. tomcat 配置域名访问应用

    <Host appBase="webapps" autoDeploy="true" name="www.XXX.com" unpack ...

  5. openssl初步使用

    centos平台 md5.c #include <stdio.h> #include <string.h> #include <stdlib.h> //#inclu ...

  6. Bootstrap的起步

    -- Bootstrap的起步部分是对Bootstrap的基本了解,有些细节只是在后面的完善时候需要详细阅读. 最基本点还是Css 和组件部分,这部分应该先进行练习....高级阶段是Javascrip ...

  7. Mac OS X Git安装教程

    http://code.google.com/p/git-osx-installer上也提供了一个Git的图形化客户端:OpenInGitGui,可以从这里获得,OpenInGitGui十分小巧,下载 ...

  8. 【搜索】Fliptile

    #include<stdio.h> #include<stdlib.h> #include<string.h> ; ; typedef long long ll; ...

  9. DHT

    DHT(Distributed Hash Table,分布式哈希表)类似Tracker的根据种子特征码返回种子信息的网络.DHT全称叫分布式哈希表(Distributed Hash Table),是一 ...

  10. ios 内存管理与property copy strong weak assign

    - (void)fun{  NSString* str = [[NSString alloc] initWithString:@"string"];  NSLog(@"% ...