listen 443 ssl http2 default_server; ssl_certificate server.crt; ssl_certificate_key server.key; root /usr/share/nginx/html; location = /demo.html { http2_push /style.css; #推送URL的路径 http2_push /image1.jpg; } }
1.3.4 安装openssl 、openssl -devel 控件添加的模块 HTTPS协议支持到HTTP服务器。默认情况下不构建此模块。构建和运行此模块需要OpenSSL库。如果不需要支持HTTPS协议不需要安装OpenSSL library。如果使用需要在构建Nginx 时候加上参数 --with-http_ssl_module 安装命令如下: yum install openssl -y yum install openssl...
} } server { # listen 80; listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name _; ssl_certificate "pem"; ssl_certificate_key "key"; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_ciphers PROFILE=SYSTEM; ssl_prefer_server_ciphers...
http2 & https 配置域名和访问的路径与http完全相同,区别在于证书 查看443端口是否打开 1.找个个证书 2.修改nginx.conf 文件 server{listen443ssl http2 default_server;listen[::]:443ssl http2 default_server;server_name m.xxx.com;root/service;ssl_certificate"/etc/nginx/cert/214744744310771.pem";// ...
listen [::]:80 default_server; 为什么会有两个listen呢?第一个listen指的是所有的IPv4连接,第二个listen指的是IPv6连接。 因为HTTP2需要开启SSL支持,所以我们这里将其修改为443,并且加上http2支持如下所示: listen 443 ssl http2; server_name www.flydean.com; ...
--with-http_v2_module和--with-http_ssl_module用于支持HTTP2和ssl加密, --with-openssl=用于指定openssl库的安装目录 --with-openssl-opt=enable-tls1_3用于开启openssl库的tls1.3支持,但是现在的新版本已经默认开启,无需额外添加这个参数 剩下的就和常规的编译安装无异,下面是此次编译的参数: ...
server { listen 443 ssl http2;#开启了HTTP2版本,加载速度是HTTP1.1的7倍左右 listen [::]:443 ssl http2;#开启了HTTP2版本,加载速度是HTTP1.1的7倍左右 ssl_certificate /etc/nginx/cert/full_chain.pem; ssl_certificate_key /etc/nginx/cert/private.key; ...
(1) 打开Nginx配置文件,通常位于/etc/nginx/nginx.conf或/etc/nginx/conf.d/default.conf。 (2) 在http块中,配置SSL相关参数。示例如下: 复制 代码语言:javascript 复制 http{...server{listen443ssl;server_name example.com;ssl_certificate/path/to/example.com.crt;# 证书文件路径 ...
listen [::]:443 ssl http2; # the domain name it will serve for server_name app.airoubo.com; # substitute your machine's IP address or FQDN include /etc/nginx/snippets/letsencrypt.conf; charset utf-8; ssl_certificate /etc/letsencrypt/live/app.airoubo.com/fullchain.pem; ...
http { #设定mime类型,类型由mime.type文件定义 include mime.types; #默认文件类型,默认为text/plain default_type application/octet-stream; #日志格式 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' ...