CentOS 7配置nginx-1.13.10支持http/2和Server Push
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的更多相关文章
- CentOS 7 配置 nginx php-fpm 详细教程
CentOS 7 配置 Nginx 的步骤如下: 首先更新 yum,没有安装 yum 的自行安装 yum update 1. 安装 Nginx yum install nginx 开启 Nginx 并 ...
- centos下配置nginx支持php
添加nginx 默认主页index.php vim .../etc/nginx/conf.d/default.conf location / { root /usr/share/nginx/htm ...
- CentOS 中 配置 Nginx 支持 https
一.基础设置: .yum -y update .yum -y install openssl* .cd /usr/local/nginx/conf .mkdir ./ssl .cd ./ssl # 在 ...
- Linux(CentOS 7)+ Nginx(1.10.2)+ Mysql(5.7.16)+ PHP(7.0.12)完整环境搭建
首先安装Linux系统,我以虚拟机安装来做示例,先去下载 VitualBox,这是一款开源的虚拟机软件,https://www.virtualbox.org 官网地址.或者是VMware,www.vm ...
- CentOS 7 配置 Nginx 正向代理 http、https 最详解
手头项目中有使用到 nginx,因为使用的三方云服务器,想上外网需要购买外网IP的,可是有些需要用到外网却不常用的主机也挂个外网IP有点浪费了,便想使用nginx的反向代理来实现多台内网服务器使用一台 ...
- centos 7 配置nginx
安装nginx: curl -o nginx.rpm http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0. ...
- 【CentOs】配置nginx
参考资料:http://nginx.org/en/linux_packages.html#stable 1.添加nginx.repo 2.配置nginx 3.启动nginx 1.添加nginx.rep ...
- Ubuntu配置Nginx虚拟主机和支持ThinkPHP
[Nginx配置虚拟主机] 每一个 server { listen 80; server_name www.a.com; ..... } 就表示一台虚拟域名, 然后对应的 ...
- CentOS 7 配置nginx并默认强制使用https对http进行跳转
1.安装nginx yum install nginx 2.启动nginx服务 service nginx start 3.开启防火墙80端口,云服务器和本地虚拟服务器各有不同,不再赘述. 4.访问你 ...
随机推荐
- 在vue中的点击事件怎么获取当前点击的元素
首先 vue的点击事件 是用 @click = “clickfun()” 属性 在html中绑定的,在点击的函数中 添加$event 参数就可以比如<button @click = “click ...
- dubbo学习(zz)
dubbo学习 博客分类: 开源软件 Dubbo是阿里巴巴SOA服务化治理方案的核心框架,每天为2,000+个服务提供3,000,000,000+次访问量支持,并被广泛应用于阿里巴巴集团的各成员站 ...
- 【Linux】DNS服务-BIND基础配置(二)
BIND简介 现在使用最为广泛的DNS服务器软件是BIND(Berkeley Internet Name Domain),最早有伯克利大学的一名学生编写,现在最新的版本是9,有ISC(Internet ...
- Time的各种变量unity3d
Time.time:(只读)表示从游戏开发到现在的时间,会随着游戏的暂停而停止计算. Time.timeSinceLevelLoad:(只读)表示从当前Scene开始到目前为止的时间,也会随着暂停操作 ...
- 8个开发必备的PHP功能--转(柒捌玖零)
做过PHP开发的程序员应该清楚,PHP中有很多内置的功能,掌握了它们,可以帮助你在做PHP开发时更加得心应手,本文将分享8个开发必备的PHP功能,个个都非常实用,希望各位PHP开发者能够掌握. 1.传 ...
- IBM X3650 M3/M4的服务器装系统
IBM X3650 M3/M4的服务器一般都有两块以上的硬盘.所以如果没有做RAID,那首先应该做好raid 磁盘阵列.本文装系统的前提是RAID已经做好. 一般安装系统的方式为先在IBM官网下载对应 ...
- java正则表达式笔记
import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntax ...
- 开启Greenplum DataBase报错:could not bind IPv4 socket: Address already in use
在运行gpstart时无法开启服务,查看日志看到下图所示错误: 查看日志错误大概是端口已被占用,所以无法重启. 解决方法: (1)利用ipcs查看数据库占用的共享内存.(如下图所示) (2)查看数据库 ...
- XMind使用教程
使用XMind,可以轻松创建.管理及控制思维导图.1. 启动XMind,选择一个空白模板或模板创建:2. 单击中心主题,输入文字即可对中心主题重命名:3. 使用键盘Enter键创建主要/同级主题,使用 ...
- idea设置字体大小
第一次玩儿idea,也是个新手小白,甚是惭愧,也是一步步慢慢摸索,下面我们按照步骤一步步操作 就可以了. 1.首先,先设置代码的字体大小: 2.设置周围菜单栏的字体大小: 3.设置控制台的字体大小: