nginx 1.17.3 and TLSv1.3
benztoy
nginx-forum at forum.nginx.org
Fri Aug 16 18:15:22 UTC 2019
I want to run two nginx services on one host. They are nginxA and nginxB
nginxA listening on https443 port. Only the tslv1.3 protocol is available.
The configuration file is as follows:
#####################
#user nobody;
Worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
Events {
Worker_connections 1024;
}
Http {
Include mime.types;
Default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request"
'
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
Sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
Keepalive_timeout 65;
#gzip on;
Server {
Listen 80;
Server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
Location / {
Root html;
Index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
Error_page 500 502 503 504 /50x.html;
Location = /50x.html {
Root html;
}
#代理 the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based
configuration
#
#server {
#听 8000;
#听 somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
Server {
Listen 443 ssl;
Server_name localhost;
Ssl_certificate cert.pem;
Ssl_certificate_key cert.key;
Ssl_session_cache shared: SSL: 1m;
Ssl_session_timeout 5m;
Ssl_protocols TLSv1.3;
Ssl_ciphers
TLS13-AES-128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
Ssl_prefer_server_ciphers on;
Location / {
Root html;
Index index.html index.htm;
}
}
}
###############
nginxB listening on the https444 port.
Just provide the proxy function, redirect to the https443 port(nginxA), and
only provide the tslv1.3 protocol, the configuration file is as follows:
###############
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request"
'
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based
configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
server {
listen 444 ssl;
server_name localhost;
ssl_certificate cert.pem;
ssl_certificate_key cert.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers
TLS13-AES-128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://127.0.0.1/;
proxy_ssl_session_reuse off;
}
}
}
###############
In fact, their relationship is
nginxB(listening on 444 tslv1.3)=> proxy => nginxA(listening on 443 tslv1.3
)
But when I visit https://127.0.0.1:444
Return to 502 Bad Gateway
Among them, nginx serving port 444 has error.log:
SSL_do_handshake() failed (SSL: error:1409442E:SSL
routines:ssl3_read_bytes:tlsv1 alert protocol version:SSL alert number 70)
while SSL handshaking to upstream, client: 127.0.0.1, server: localhost,
request: "GET / HTTP/1.1 ", upstream: "https://127.0.0.1:443/", host:
"127.0.0.1:444"
Dear friends, What is the reason for this?
My first service ssl protocol version of nginxA must be tslv1.3 only. There
is no other lower version. Can I successfully access https://127.0.0.1:444
by modifying the nginxA or nginxB configuration file?
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285325,285325#msg-285325
More information about the nginx
mailing list