当前位置: 首页 > news >正文

做网站数据库坏了做的网站怎么上传

做网站数据库坏了,做的网站怎么上传,虚拟机可以做多个网站,企业做的网站费入什么科目求背景 为了封禁某些爬虫或者恶意用户对服务器的请求#xff0c;我们需要建立一个动态的 IP 黑名单。对于黑名单之内的 IP #xff0c;拒绝提供服务。并且可以设置失效 1.安装Openresty#xff08;编译安装#xff09; wget https://openresty.org/download/openresty-1.…求背景 为了封禁某些爬虫或者恶意用户对服务器的请求我们需要建立一个动态的 IP 黑名单。对于黑名单之内的 IP 拒绝提供服务。并且可以设置失效 1.安装Openresty编译安装 wget https://openresty.org/download/openresty-1.19.3.1.tar.gz # 解压openresty tar -zxvf openresty-1.19.3.1.tar.gz 下载缓存插件   wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz#解压缓存插件 tar -zxvf ngx_cache_purge-2.3.tar.gz cd openresty-1.19.3.1/ mkdir modules # 把刚解压的ngx_cache_purge移动到该目录下 编译OpenResty 选择需要的插件启用, –with-Components 激活组件–without 则是禁止组件 ,–add-module是安装第三方模块。 进入刚刚解压好的openresty-1.19.3.1根目录下执行命令 ./configure --prefix/usr/local/openresty --with-luajit --without-http_redis2_module --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --add-module/usr/local/openresty-1.19.3.1/modules/ngx_cache_purge-2.3 –prefix/usr/local/openresty 刚自己创建的目录用来存放编译后的openresty–add-module/usr/local/openresty-1.19.3.1/xxx 存放第三方插件的位置 2.安装redis 这里我是基于docker安装的redis  docker run --restartalways -p 6379:6379 --name myredis -d redis:7.0.12 --requirepass xxx- -requirepass 是redis密码 3.写lua脚本 ip_bind_time 30 --封禁IP多长时间 ip_time_out 6 --指定统计ip访问频率时间范围 connect_count 10 --指定ip访问频率计数最大值 --上面的意思就是6秒内访问超过10次自动封 IP 30秒。--连接redis local redis require resty.redis local cache redis.new() local ok , err cache.connect(cache,127.0.0.1,6379) -- redis密码 local res, err cache:auth(xxx) cache:set_timeout(60000)--如果连接失败跳转到脚本结尾 if not ok thengoto Lastend end--查询ip是否在封禁段内若在则返回403错误代码 --因封禁时间会大于ip记录时间故此处不对ip时间key和计数key做处理 is_bind , err cache:get(bind_..ngx.var.remote_addr)if is_bind 1 thenngx.exit(ngx.HTTP_FORBIDDEN)-- 或者 ngx.exit(403)-- 当然你也可以返回500错误啥的搞一个500页面提示亲您访问太频繁啥的。goto Lastend endstart_time , err cache:get(time_..ngx.var.remote_addr) ip_count , err cache:get(count_..ngx.var.remote_addr)--如果ip记录时间大于指定时间间隔或者记录时间或者不存在ip时间key则重置时间key和计数key --如果ip时间key小于时间间隔则ip计数1且如果ip计数大于ip频率计数则设置ip的封禁key为1 --同时设置封禁key的过期时间为封禁ip的时间if start_time ngx.null or os.time() - start_time ip_time_out thenres , err cache:set(time_..ngx.var.remote_addr , os.time())res , err cache:set(count_..ngx.var.remote_addr , 1) elseip_count ip_count 1res , err cache:incr(count_..ngx.var.remote_addr)if ip_count connect_count thenres , err cache:set(bind_..ngx.var.remote_addr,1)res , err cache:expire(bind_..ngx.var.remote_addr,ip_bind_time) --fix keysend end --结尾标记 ::Lastend:: local ok, err cache:close() #user nobody; worker_processes 1;#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024; }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;sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root html;index index.html index.htm;access_by_lua_file /usr/local/openresty/nginx/lua/access_by_redis.lua;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location /50x.html {root html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {# root html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params;#}# deny access to .htaccess files, if Apaches document root# concurs with nginxs one##location ~ /\.ht {# deny all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {# listen 8000;# listen somename:8080;# server_name somename alias another.alias;# location / {# root html;# index index.html index.htm;# }#}# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}}启动下就可以了
http://www.sadfv.cn/news/151805/

相关文章:

  • 教育品牌加盟网站建设网络科技公司简介范文
  • 深圳网站建设哪个好网页游戏排行版
  • 2010年青海省建设厅网站2345浏览器官网首页
  • wordpress怎么把category淘宝seo培训
  • 网站设计美工多少做网站有用没
  • 商城网站前期推广查询注册过哪些网站
  • 沈阳 教育 公司 网站建设郓城住房和城乡建设厅网站
  • 黄浦网站建设推广做淘客网站的公司
  • 网站建设培训多少钱广州网站建设咨询电话
  • 免费网站正能量小说海南做网站
  • windows 7 wordpress无锡网站seo报价
  • 网站后台fpt怎么在服务器建立网站
  • 如何架设一个网站黑龙江省网站前置审批网站
  • 网站的收录百度指数电脑端查询
  • wordpress iis 发布企业做网站乐云seo快速上线
  • 济南全网营销型网站建设通州网站开发公司
  • 做名片的网站叫什么来着网页传奇游戏排行榜2014前十名
  • 网站开发技术和seo的联系wordpress公告模板
  • 景县网站建设新办公司网上核名在哪个网站做
  • 大鹏新区网站建设口碑好的企业网站建设
  • 南京做网站群的公司求网站建设
  • 网站开发的工资一般是多少做一个app需要投资多少钱
  • 长春网站建设价格网站建设管理工作情况的通报
  • 网站制作网站设计企业画册设计印刷制作
  • 荣欣建设集团有限公司网站核酸检测收费
  • 北京物流网站建设关键词歌词打印
  • js特效网站wordpress wpenqueuestyle
  • 高端网站建设公司兴田德润在那里大学生创新创业网站开发
  • 自己做影视网站如何查询企业信用信息
  • 西安建设集团网站医院网站云服务器配置