VPS侦探论坛

 找回密码
 注册
查看: 919|回复: 4

关于waf安装的到web反代的问题

[复制链接]
发表于 2023-4-20 16:06:15 | 显示全部楼层 |阅读模式

安装完,默认的IP测试没问题,

然后我再测试加到nginx反代中,好像不行~~~~
下面配置贴 图
这个是默认的nginx,通过IP访问的,是测试通过的,




由于附件图片过大,下面贴 代码
  1. <blockquote>server
复制代码
代码上面,我感觉没配错,网页上域名后加
http://域名/test.php?id=../etc/passwd 来测试
直接跳404,这是什么鬼,是不是配置失败了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2023-4-20 16:13:52 | 显示全部楼层


nginx.conf配置文件
  1. user  www www;

  2. worker_processes auto;
  3. worker_cpu_affinity auto;

  4. error_log  /home/wwwlogs/nginx_error.log  crit;

  5. pid        /usr/local/nginx/logs/nginx.pid;

  6. #Specifies the value for maximum file descriptors that can be opened by this process.
  7. worker_rlimit_nofile 51200;

  8. events
  9.     {
  10.         use epoll;
  11.         worker_connections 51200;
  12.         multi_accept off;
  13.         accept_mutex off;
  14.     }

  15. http
  16.     {
  17.         include       mime.types;
  18.         default_type  application/octet-stream;

  19.         server_names_hash_bucket_size 128;
  20.         client_header_buffer_size 32k;
  21.         large_client_header_buffers 4 32k;
  22.         client_max_body_size 50m;
  23.         upstream myserver {
  24.             ip_hash;
  25.             server IP:443;
  26.         }

  27.         sendfile on;
  28.         sendfile_max_chunk 512k;
  29.         tcp_nopush on;

  30.         keepalive_timeout 60;

  31.         tcp_nodelay on;

  32.         proxy_cache_path /data/bimg levels=1:2 keys_zone=bimg:500m inactive=120m max_size=5g;
  33.         proxy_cache_path /data/s levels=1:2 keys_zone=s:500m inactive=120m max_size=5g;
  34.         proxy_cache_valid 200 304 302 24h;
  35.         include proxy.conf;


  36.         fastcgi_connect_timeout 300;
  37.         fastcgi_send_timeout 300;
  38.         fastcgi_read_timeout 300;
  39.         fastcgi_buffer_size 64k;
  40.         fastcgi_buffers 4 64k;
  41.         fastcgi_busy_buffers_size 128k;
  42.         fastcgi_temp_file_write_size 256k;

  43.         gzip on;
  44.         gzip_min_length  1k;
  45.         gzip_buffers     4 16k;
  46.         gzip_http_version 1.1;
  47.         gzip_comp_level 2;
  48.         gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
  49.         gzip_vary on;
  50.         gzip_proxied   expired no-cache no-store private auth;
  51.         gzip_disable   "MSIE [1-6]\.";

  52.         #limit_conn_zone $binary_remote_addr zone=perip:10m;
  53.         ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.

  54.         server_tokens off;
  55.         lua_package_path "/usr/local/nginx/conf/waf/?.lua";
  56.         lua_shared_dict limit 10m;
  57.         init_by_lua_file /usr/local/nginx/conf/waf/init.lua;
  58.         access_log on;

  59. server
  60.     {
  61.         listen 80 default_server reuseport;
  62.         #listen [::]:80 default_server ipv6only=on;
  63.         server_name _;
  64.         index index.html index.htm index.php;
  65.         root  /home/wwwroot/default;
  66.         access_by_lua_file /usr/local/nginx/conf/waf/waf.lua;
  67.         #error_page   404   /404.html;

  68.         # Deny access to PHP files in specific directory
  69.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  70.         include enable-php.conf;

  71.         location /nginx_status
  72.         {
  73.             stub_status on;
  74.             access_log   off;
  75.         }

  76.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  77.         {
  78.             expires      30d;
  79.         }

  80.         location ~ .*\.(js|css)?$
  81.         {
  82.             expires      12h;
  83.         }

  84.         location ~ /.well-known {
  85.             allow all;
  86.         }

  87.         location ~ /\.
  88.         {
  89.             deny all;
  90.         }

  91.         access_log  /home/wwwlogs/access.log;
  92.     }
  93. include vhost/*.conf;
  94. }
复制代码

vhost/web.conf
  1. server {
  2.         listen 80;
  3.         server_name  www.xxxxx.com;
  4.         rewrite ^(.*) https://$host$1 permanent;
  5. }
  6. server
  7.     {
  8.         listen 443 ssl;
  9.         server_name www.xxxxx.com;
  10.         root /www/web/;
  11.         access_by_lua_file /usr/local/nginx/conf/waf/waf.lua;

  12.         ssl_certificate ssl/www.xxxxx.com.crt;
  13.         ssl_certificate_key ssl/www.xxxxx.com.key;
  14.         ssl_session_timeout 5m;
  15.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  16.         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
  17.         ssl_prefer_server_ciphers on;
  18.         location ~/* {
  19.             proxy_set_header Host www.xxxxx.com;
  20.             proxy_pass   https://myserver;
  21.             index  index.php index.html index.htm;
  22.             proxy_cache www.xxxxx.com;
  23.             proxy_cache_valid 200 20m;
  24.         }
  25.         include guize/zhizhu.conf;
  26.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  27.         {
  28.             expires      30d;
  29.         }

  30.         location ~ .*\.(js|css)?$
  31.         {
  32.             expires      12h;
  33.         }

  34.         location ~ /.well-known {
  35.             allow all;
  36.         }

  37.         location ~ /\.
  38.         {
  39.             deny all;
  40.         }

  41.         access_log /www/log/www.xxxxx.com.log;
  42.     }
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2023-4-21 08:07:42 | 显示全部楼层

test.php不存在的话是无法测试的,没有test.php ,你看看你网站根目录下有什么.php的文件,一般 index.php 肯定有吧,有就替换为 index.php 进行测试
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2023-4-21 21:17:28 | 显示全部楼层



licess 发表于 2023-4-21 08:07
test.php不存在的话是无法测试的,没有test.php ,你看看你网站根目录下有什么.php的文件,一般 index.php  ...

这个lua的功能 ,是不是不支持html,不支持恶意采集访问之类的。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2023-4-22 10:51:21 | 显示全部楼层

zhuzhu0628 发表于 2023-4-21 21:17
这个lua的功能 ,是不是不支持html,不支持恶意采集访问之类的。

有防cc的功能
    CCrate = "100/60"
    --设置cc攻击频率,单位为秒.
    --默认1分钟同一个IP只能请求同一个地址100次

满足触发条件就可以
或者useragent之类的有明显特征也可以加上

军哥运维代购:http://shop63846532.taobao.com/

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-7-27 12:07 , Processed in 0.027546 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表