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.访问你 ...
随机推荐
- How to return AJAX errors from Laravel Controller?
Questions: I am building a REST API with Laravel 5. In Laravel 5, you can subclassApp\Http\Requests\ ...
- Maximum Subarray LT53
Given an integer array nums, find the contiguous subarray (containing at least one number) which has ...
- mysql 查询 所有 父节点 单表
SELECT T2.* FROM ( SELECT @r AS _id, ( SELECT @r := parent_id FROM tp_module_rel WHERE REL_ID = _id ...
- sqlserver 误删数据库恢复
本文为转载 原文:https://blog.csdn.net/xwnxwn/article/details/53537841 由于长时间从事企业应用系统开发,前往用户现场升级.调试系统是比较常做的事情 ...
- ListView嵌套 EditText的光标不显示
ListView嵌套EditView,有可能会出现了下面现象: 点击EditView,EditView获取焦点后,有可能光标不显示,也有可能光标不闪烁.点击多次后,光标才正常显示. 获取焦点后,edi ...
- centos6.5虚拟机每次都要ifup eth0的解决办法
修改文件/etc/sysconfig/network-scripts/ifcfg-eth0把ONBOOT=no改ONBOOT=yes
- SyntaxError: missing ; before statement
做分页功能,遇到了很坑的事情.前台一直报错:SyntaxError: missing ; before statement 最后发现解决办法是eval("("+s+")& ...
- 【Redis】Redis cluster集群搭建
Redis集群基本介绍 Redis 集群是一个可以在多个 Redis 节点之间进行数据共享的设施installation. Redis 集群不支持那些需要同时处理多个键的 Redis 命令, 因为执行 ...
- 674. Longest Continuous Increasing Subsequence
static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { publ ...
- zend studio导入外部项目乱码怎么解决
在zendstudio ide中,导入一个工程后,发现工程里面很多的文件都打上了红色的叉叉,打开这些文件一看,发现只要是有汉字存在的文件,都出现了乱码.按住alt+enter发现,该文件的编码默认为g ...