回答
收藏
分享
举报
nginx反向代理http2.0问题
提问于2022-02-25 17:42

浏览 2.2k

文章标签

在网上很少能找到nginx反向代理http2.0服务的配置,我看好像说nginx不能代理http2.0,只能作为http2.0的服务是对的不,谢谢


已修改于2023-03-17 13:43



写下您的回答
发表回答
全部回答(2)

按点赞数排序

按时间排序

不支持反向代理http2.0

赞同

0

回复举报

回答于2022-10-31 14:11



回复jiayouachunyu
回复

好像确实如此,好像是基于安全的原因。https://trac.nginx.org/nginx/ticket/923

赞同

0

回复举报

回答于2022-02-28 23:18



回复qx5147
回复
提问者
滴水
这家伙很懒还未留下介绍~
0
文章
1
问答
0
粉丝
相关问答

waf全称是Web Application Firewall,所以,能处理HTTP协议的负载均衡软件,都可以作为Waf。然而,如果性能太差,这个Waf就很容易被轻微的流量攻击打挂,而Nginx性能非常优异,因此常用于Waf。另一方面,Waf需要解析HTTP协议,包括body中的表单信息,纯粹用C语言编写工作量非常大,因此OpenResty常常是Waf的首选。

点赞 0
浏览 2.8k

你是说走syslog协议吗?是的。

点赞 0
浏览 937

nginx可以通过ngx_lua_waf实现waf。首先需要安装luajit运行时和nginx
一、luajit运行时安装参考openresty官方:
https://github.com/openresty/lua-nginx-module#installation
我使用的如下三个版本:luajit2-2.1-20220411.tar.gz lua-nginx-module-0.10.21.tar.gz ngx_devel_kit-0.3.1.tar.gz
二、nginx安装:
我的编译参数,--prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --add-module=/home/lq/work/tongmingzhiyun/openresty/lua-nginx-module-0.10.21 --add-module=/home/lq/work/tongmingzhiyun/openresty/ngx_devel_kit-0.3.1
三、搭建waf防火墙:
参考ngx_lua_waf github仓库 readme,https://github.com/loveshell/ngx_lua_waf,需要注意的地方,
1.我的环境中其他lua包在/etc/nginx/lua/下,所以lua_package_path需要多加一个目录
lua_package_path '/opt/nginx/conf/waf/?.lua;/etc/nginx/lua/?.lua;;';
lua_shared_dict limit 10m;
init_by_lua_file /opt/nginx/conf/waf/init.lua;
access_by_lua_file /opt/nginx/conf/waf/waf.lua;
2.测试的时候不能使用127.0.0.1
curl http://127.0.0.1:80/test.php?id=../etc/passwd,防火墙args规则中白名单中有127.0.0.1,这样导致127.0.0.1的请求不会进行waf处理(这里需要注意,否则会花费大量时间排查),可以使用其他网卡地址,比如我使用ens33,
root@ubuntu:/opt/nginx# curl http://192.168.175.128:80/test.php?id=../etc/passwd
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>网站防火墙</title>
<style>
p {
line-height:20px;
}
ul{ list-style-type:none;}
li{ list-style-type:none;}
</style>
</head>

<body style=" padding:0; margin:0; font:14px/1.5 Microsoft Yahei, 宋体,sans-serif; color:#555;">

<div style="margin: 0 auto; width:1000px; padding-top:70px; overflow:hidden;">


<div style="width:600px; float:left;">
<div style=" height:40px; line-height:40px; color:#fff; font-size:16px; overflow:hidden; background:#6bb3f6; padding-left:20px;">网站防火墙 </div>
<div style="border:1px dashed #cdcece; border-top:none; font-size:14px; background:#fff; color:#555; line-height:24px; height:220px; padding:20px 20px 0 20px; overflow-y:auto;background:#f3f7f9;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#fc4f03;">您的请求带有不合法参数,已被网站管理员设置拦截!</span>


<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">可能原因:您提交的内容包含危险的攻击请求


<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;">如何解决:


<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">1)检查提交内容;</li>
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">2)如网站托管,请联系空间提供商;</li>
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">3)普通网站访客,请联系网站管理员;</li></ul>
</div>
</div>
</div>
</body></html>

root@ubuntu:/opt/nginx#

可以参考如下博客:
https://blog.csdn.net/m0_37814112/article/details/119967839?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-119967839-blog-106795279.pc_relevant_multi_platform_featuressortv2dupreplace&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-119967839-blog-106795279.pc_relevant_multi_platform_featuressortv2dupreplace&utm_relevant_index=2

点赞 0
浏览 804