浏览 4.4k
安装的是fastpanel 面板 新手,请勿喷
它的nginx默认安装路径是/ect/nginx
[img]https://www.544445.xyz/images/2022/06/14/QQ20220614151311.png[/img]
[img]https://www.544445.xyz/images/2022/06/14/QQ20220614151524.png[/img]
[img]https://www.544445.xyz/images/2022/06/14/QQ20220614151553.png[/img]
请问大佬们 怎么安装
百度学习了 搞不定 T-T
新手,请勿喷
请大佬指点下

按点赞数排序
按时间排序
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>
0
回答于2022-10-31 14:04
第1种。参考官方文档:
“When buffering is enabled, nginx receives a response from the proxied server as soon as possible, saving it into the buffers set by the proxy_buffer_size and proxy_buffers directives. If the whole response does not fit into memory, a part of it can be saved to a temporary file on the disk. Writing to temporary files is controlled by the proxy_max_temp_file_size and proxy_temp_file_write_size directives.
When buffering is disabled, the response is passed to a client synchronously, immediately as it is received. nginx will not try to read the whole response from the proxied server. The maximum size of the data that nginx can receive from the server at a time is set by the proxy_buffer_size directive.”
当遇到反向代理302错误和静态资源403错误时,可以采取几个步骤来解决问题。以下是帮助您的一般指南:
请记住,所提供的步骤是通用指南,实际的解决方案可能取决于特定的配置和环境。如果在完成这些步骤后仍然遇到问题,建议您查阅文档或向反向代理或Web服务器供应商寻求支持。
LOG如下:偶数次是超时。
Hello and welcome!
test-->
--->
0:{"user": "demo1","age": 1}
--1->
--2: 200
--3:: [POST] test!
--5->
disconnect()
return :[POST] test!
--->
1:{"user": "demo1","age": 2}
--1->
java.net.SocketTimeoutException: Read timed out
disconnect()
return :java.net.SocketTimeoutException: Read timed out
--->
2:{"user": "demo1","age": 3}
--1->
--2: 200
--3:: [POST] test!
--5->
disconnect()
return :[POST] test!
--->
3:{"user": "demo1","age": 4}
--1->
java.net.SocketTimeoutException: Read timed out
disconnect()
return :java.net.SocketTimeoutException: Read timed out
--->
4:{"user": "demo1","age": 5}
--1->
--2: 200
--3:: [POST] test!
--5->
disconnect()
return :[POST] test!
--->
5:{"user": "demo1","age": 6}
--1->
java.net.SocketTimeoutException: Read timed out
disconnect()
return :java.net.SocketTimeoutException: Read timed out
Process finished with exit code 0
微信公众号
加入微信群