nginx ssl 透傳

nginx 4層ssl:

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module

node2:/root/nginx-1.17.9#/usr/local/nginx/sbin/nginx -c /etc/nginx/nginx_9000.conf 


node2:/etc/nginx#cat /etc/nginx/nginx
cat: /etc/nginx/nginx: No such file or directory
node2:/etc/nginx#cat /etc/nginx/nginx_9000.conf 
user nginx nginx;
worker_processes auto;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;

events {
use epoll;
worker_connections 51200;
multi_accept on;
}

stream {
 map $ssl_preread_server_name $name {
   default test_9000;
}
log_format proxy '$remote_addr [$time_local]'
"$protocol|" "$status|" "$bytes_sent|" "$bytes_received|"
$session_time| "$upstream_addr|"
"$upstream_bytes_sent|" "$upstream_bytes_received|" "$upstream_connect_time|";
access_log /var/log/nginx/tcp-access.log proxy ;
error_log  /var/log/nginx/tcp-error.log warn ;

server {
listen 8080;
proxy_pass $name;
proxy_connect_timeout 1s; #後端鏈接空閒超時斷開
proxy_timeout 10s;#後端連接超時時間
}


upstream test_9000 {
server 192.168.137.3:9000 ;
}

}


django日誌:

[31/May/2020 23:45:23] code 400, message Bad request version ('xh\xe2\xae=q\xde?\x185q\xbdzV\xe54}\x90_\xa4\xff\xd0\xc8\x90\x02{.\x8b~D\xe6\xb0\x00"\x9a\x9a\x13\x01\x13\x02\x13\x03\xc0+\xc0/\xc0,\xc00\xcc\xa9\xcc\xa8\xc0\x13\xc0\x14\x00\x9c\x00\x9d\x00/\x005\x00')
[31/May/2020 23:45:23] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x02\x00\x01\x00\x01\xfc\x03\x03?\x063\xe4\xdcE\xfc\x1eKS\xdd&\xde_\xb7\xa7\x9b0\xc5\xb5)\xc8\xf2\xda\xb1\x04\xc4"a\xf5h&')
[31/May/2020 23:45:23] You're accessing the development server over HTTPS, but it only supports HTTP.

[31/May/2020 23:45:23] You're accessing the development server over HTTPS, but it only supports HTTP.

[31/May/2020 23:45:23] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x02\x00\x01\x00\x01\xfc\x03\x03Fx\x13\xd4\xa2\xb3\x17\x11l\x9d*\xda2\xcfg\xcc\x06\xd6\xfc\x00,\xc0b\xd3I\xfd\xe3z#\x15\xb1o')
[31/May/2020 23:45:23] You're accessing the development server over HTTPS, but it only supports HTTP.

[31/May/2020 23:45:23] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x00\xb1\x01\x00\x00\xad\x03\x03\xf9\xa2\x05\xe2\x07')
[31/May/2020 23:45:23] You're accessing the development server over HTTPS, but it only supports HTTP.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章