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. \\Device\\PhysicalMemory

    从Windows Server 2003 with SP1 以后就禁用了用户态访问\\Device\\PhysicalMemory,要访读取SMBIOS的信息,请使用以下API:•EnumSystem ...

  2. [Groovy] 创建Excel,追加Excel

    package ScriptLibrary import java.awt.Color import java.awt.GraphicsConfiguration.DefaultBufferCapab ...

  3. SSH无法连上CentOS7的问题

    今天安装完带GNOME的CentOS后发现XShell无法连接上Linux. 原因是sshd服务没有开启.下面是解决办法: 1 ip addr 发现网卡名称为ens33 2 在/etc/sysconf ...

  4. firefox 之 event兼容写法

    event 在 IE 和 FF(Firefox) 中是不兼容的,IE 中可以直接使用 event 对象,而 FF 中则不可以,解决方法之一如下: var event = window.event || ...

  5. 验证签名机制——java示例

    简单的验证公钥私钥签名认证: 公钥是对外公开的部分,私钥是不公开的部分,一般在项目开发中公钥是给用户,私钥是存于服务器上,二者中有一个加密,则需要另外一个来解密. 下面是java实现的一个比较简单的示 ...

  6. navigator - 定时器 - event

    1. navigator userAgent: 包含浏览器名称,内核,版本号的字符串 鄙视: 如何判断浏览器名称和版本号 2. 定时器: 2种: 1. 周期性定时器: 什么是: 让程序每隔一段时间间隔 ...

  7. 使用EventLog Analyzer监控、管理及分析日志

  8. python console 设立快捷键 学习源码 用到英语

    arbitrary---随意 iterable----迭代 invalid syntax   -----无效的语法 subscriptable   ----可索引访问的

  9. idea运行项目时报Error:java无效的源发行版:1.8

    如果你安装的是JDK1.7,而在file->project structure中设置的是language level是8的话,就会出现这个错误提示:无效的源发行版:8. 解决办法:将语言级别改为 ...

  10. hdu-1033(格式)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1033 参考文章:https://blog.csdn.net/curson_/article/detai ...