nginx代理tcp协议_tcp怎么加密传输

nginx代理tcp协议_tcp怎么加密传输NGINX实现TCP加密代理

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

实现转发MySql、Redis、矿池ssl 以及各种TCP转发

NGINX实现TCP代理

源码安装NGINX

NGINX官网源码包:NGINX官网下载地址

wget https://nginx.org/download/nginx-1.20.1.tar.gz
tar -zxf nginx-1.20.1.tar.gz
yum install -y pcre-devel pcre zlib zlib-devel openssl openssl-devel wget gcc gcc-c++ unzip
useradd -s /sbin/nologin nginx
tar -xvf nginx-1.20.1.tar.gz
cd nginx-1.20.1/
sed -i '49s/nginx/Microsoft-IIS/' src/http/ngx_http_header_filter_module.c
sed -i '50s/: /: Microsoft-IIS/' src/http/ngx_http_header_filter_module.c
sed -i '51s/: /: Microsoft-IIS/' src/http/ngx_http_header_filter_module.c
./configure \
--prefix=/opt/nginx/ \
--user=nginx \
--group=nginx \
--with-pcre \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-http_v2_module \
--with-threads \
--with-stream \
--with-stream_ssl_module 
make && make install
ln -s /opt/nginx/sbin/nginx  /usr/bin/nginx
nginx
ps -aux|grep nginx

修改配置文件

vim /opt/nginx/conf/nginx.conf

worker_processes  auto;
error_log		logs/error.log error;
pid		logs/nginx.pid;
events { 
   	
	worker_connections  65535;
	multi_accept on;
}

stream{ 
   
   #Ethermine
    upstream ethermine{ 
   
    server asia1.ethermine.org:5555; #这以E池为走ssl
  }

  server { 
   
    listen 5555 ssl;
    proxy_connect_timeout 10s;
    proxy_timeout 30s;
    proxy_ssl  on;
    proxy_ssl_protocols   TLSv1 TLSv1.1 TLSv1.2;
    proxy_ssl_session_reuse on;
    
    ssl_certificate      baidu.com.crt;    #自己的域名证书
    ssl_certificate_key  baidu.com.key;
    proxy_pass ethermine;
  }   
}



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;
	keepalive_timeout  60;
	add_header Access-Control-Allow-Origin '*';
        add_header Access-Control-Max-Age '3628800';
	add_header Access-Control-Allow-Credentials 'true';
	add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
	add_header Access-Control-Allow-Methods 'GET,POST,PUT,OPTIONS';

	underscores_in_headers on;	

	client_header_buffer_size	32k;
	client_body_buffer_size	20m;
	client_max_body_size	120M;
	client_header_timeout	1m;
	client_body_timeout		1m;
	proxy_connect_timeout    600;
	proxy_read_timeout       600;
	proxy_send_timeout       600;
	large_client_header_buffers	4	32k;
	fastcgi_buffers		4	128k;
	fastcgi_buffer_size		128k;
	fastcgi_busy_buffers_size	256k;

	server_tokens off;
	tcp_nopush on;
	tcp_nodelay on;
	sendfile        on;

	gzip  on; #开启gzip
	#gzip_static on;
	gzip_vary on;
	gzip_min_length 1k;
	gzip_buffers 8 32k;
	gzip_http_version 1.1;
	gzip_comp_level 6; 
	gzip_proxied any;
	gzip_types application/javascript application/json text/css image/png;

	real_ip_header		X-Real-IP;
	proxy_set_header        Host            $host:$server_port;
	proxy_set_header        X-Real-IP       $remote_addr;
	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;   

	include      /opt/nginx/conf.d/*.conf; } 

重启NGINX

nginx -t 
nginx -s reload
netstat -nutlp 

测试

iptables 记得开启端口

telnet  xxx.com 端口
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/195524.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 两个数组拼接

    两个数组拼接方法一:vara1=[‘aa’,12,13];vara2=[21,22,23];varnewA=a1.concat(a2)方法二:vara1=[‘aa’,12,13];vara2=[21,22,23];varnewA=a1.join()+’,’+a2.join();方法三:vara1=[‘aa’,12,13];vara2…

    2022年5月20日
    43
  • java messagedigest_Java 自带的加密类MessageDigest类(加密MD5和SHA)[通俗易懂]

    java messagedigest_Java 自带的加密类MessageDigest类(加密MD5和SHA)[通俗易懂]转载转载自:http://www.tuicool.com/articles/nMNVVjJava自带的数据加密类MessageDigest(MD5或SHA加密)说明:在网站中,为了保护网站会员的用户名和密码等隐私信息,所以我们在用户注册时就直接进行MD5方式或其他方式进行加密,即使是数据库管理员也不能查看该会员的密码等信息,在数据库中查看密码效果如:8e830882f03b2cb84d1a6…

    2022年7月17日
    10
  • 你应该知道的10个奇特的 HTML5 单页网站「建议收藏」

    你应该知道的10个奇特的 HTML5 单页网站「建议收藏」网页设计师努力寻找新的方式来展现内容。其中一个大的趋势是单页网站,现在被世界上的一些大的品牌广泛采用,使用它们来为用户提供一个快速,干净和简单的而且​​美丽的网站。下面是10个令人惊叹的单页H​​T

    2022年8月3日
    3
  • @jsonIgnore不生效

    @jsonIgnore不生效本人使用的是 alibaba 的 fastjson 但是 JsonIgnore 不是 fastjson 的 所以不生效 将注解改为 JSONField serialize false JSONField 来自 com alibaba fastjson annotation 包的 然后序列化的时候就生效了 成功忽略了属性

    2025年6月17日
    0
  • [图文讲解]redis命令keys和scan的区别[通俗易懂]

    [图文讲解]redis命令keys和scan的区别

    2022年2月19日
    113
  • python怎么读取xlsx文件_arcgis地理加权回归

    python怎么读取xlsx文件_arcgis地理加权回归空间计量经济学打破大多数经典统计和计量分析中相互独立的基本假设,主要解决如何在横截面数据和面板数据的回归模型中处理空间相互作用(空间自相关)和空间结构(空间不均匀性)分析的问题。空间计量经济理论认为一个地区空间单元上的某种经济地理现象或某一属性值与邻近地区空间单元上同一现象或属性值是相关的。也就是说,各区域之间的数据存在与时间序列相关相对应的空间相关。空间计量模型所研究的空间效应包括空间自相关和空…

    2022年8月31日
    1

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号