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

烟台市做网站找哪家好建筑设计单位

烟台市做网站找哪家好,建筑设计单位,中国商标网商标查询网,怎么做网页设计稿nginx防盗链问题 盗链#xff1a; 就是a网站有一张照片#xff0c;b网站引用了a网站的照片 。 防盗链#xff1a; a网站通过设置禁止b网站引用a网站的照片。 nginx防止网站资源被盗用模块 ngx_http_referer_module 如何区分哪些是不正常的用户#xff1f; HTTP Referer…nginx防盗链问题 盗链 就是a网站有一张照片b网站引用了a网站的照片 。 防盗链 a网站通过设置禁止b网站引用a网站的照片。 nginx防止网站资源被盗用模块 ngx_http_referer_module 如何区分哪些是不正常的用户 HTTP Referer是Header的一部分当浏览器向Web服务器发送请求的时候一般会带上Referer告诉服务器我是从哪个页面链接过来的服务器借此可以获得一些信息用于处理例如防止未经允许的网站盗链图片、文件等。因此HTTP Referer头信息是可以通过程序来伪装生成的所以通过Referer信息防盗链并非100%可靠但是它能够限制大部分的盗链情况. 比如在www.google.com 里有一个www.baidu.com 链接那么点击这个www.baidu.com 它的header 信息里就有Refererhttp://www.google.com 防盗链配置要点 [rootnginx-server ~]# vim /etc/nginx/nginx.conf # 日志格式添加$http_referer log_format main $remote_addr - $remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for; # valid_referers 使用方式 Syntax: valid_referers none | blocked | server_names | string ...; Default: — Context: server, location 盗链实验 准备俩台服务器a服务器用做网站正版发布照片b服务器用作引用a服务器的图片信息的服务器。 a服务器IP192.168.231.171 b服务器IP192.168.231.173 在a服务器的配置文件内 [rootlocalhost ~]# vim /etc/nginx/conf.d/default.conf server {listen 80;server_name localhost;location /{root /usr/share/nginx/html;index 1.jpg; } }更改完配置文件 记得重启 [rootlocalhost ~]# nginx -s reload#网站默认发布页面的路径 [rootlocalhost ~]# cd /usr/share/nginx/html/ [rootlocalhost html]# ls 1.jpg 50x.html index.html正常访问a网站 b服务器配置nginx访问页面 由于b服务器也是yum安装的nginx 因此b服务器的nginx默认发布页面路径在 /usr/local/nginx/html/下 [rootdaili ~]# cd /usr/share/nginx/html/ [rootdaili html]# ls 50x.html index.htmlvim index.htmlhtml headmeta charsetutf-8 #用老做实验 红色的底titleqf.com/title /head body stylebackground-color:red;img srchttp://192.168.231.171/1.jpg/ #盗用171IP的1.jpg这个图片 /body /html此时访问b网站由于它盗用了a网站的图片因此 观察a服务器的日志 这就做成了盗链实验 防盗链实验 实验机器 a服务器IP192.168.231.174  真正提供照片的服务器 b服务器IP192.168.231.173 1.防盗链的操作得在真正发布这张图片的服务器修改配置文件 a服务器#vim /etc/nginx/conf.d/default.conf server {listen 80;server_name localhost;location /{root /usr/share/nginx/html;index 1.jpg; valid_referers server_names 192.168.231.173; #server_names 只允许指定ip域名来访问资源if ($invalid_referer) {return 502; #其他ip或者域名来访问a服务器返回502 }} }重启服务 nginx -s reload 这样就相当于将173这个ip添加到白名单中只有192.168.231.173可以访问a服务器的资源。 通过百度来访问a服务器 [rootdaili ~]# curl -e www.baidu.com -Ik 192.168.231.173 HTTP/1.1 502 Bad Gateway Server: nginx/1.24.0 Date: Mon, 23 Oct 2023 11:29:07 GMT Content-Type: text/html Content-Length: 157 Connection: keep-alive#由于在a服务器的配置文件设置只能IP为192.168.231.173的来访问因此其他ip来访问返回502 平时我们都是通过本机电脑的ip来访问b服务器而curl -e ip/域名 -Ik  要访问的ip 这条命令是我们通过此ip来访问另一个ip。 curl -e  www.baidu.com -Ik  192.168.231.173 我们通过百度来访问173IP相当于我们此时的电脑本机变成了百度。 相同的是我们设置为只有百度可以访问a服务器那么b服务器上的图片就会失真打不开 a服务器 [rootlocalhost ~]# vim /etc/nginx/conf.d/default.conf server {listen 80;server_name localhost;location /{root /usr/share/nginx/html;index 1.jpg; valid_referers server_names www.baidu.com; if ($invalid_referer) {return 502; } } }重启服务 nginx -s reload 访问b服务器的网站 三个要素 none : 允许没有http_refer的请求访问资源 blocked : 允许不是http://开头的不带协议的请求访问资源 server_names : 只允许指定ip/域名来的请求访问资源白名单 加none 真正有图片的a服务器 server {listen 80;server_name localhost;location /{root /usr/share/nginx/html;valid_referers none 192.168.231.173;index 1.jpg; } } 浏览查看a服务器的发布页面 查看日志 tailf /var/log/nginx/access.log 通过百度来访问a服务器 [rootlocalhost ~]# curl -e www.baidu,com -Ik 192.168.231.174 HTTP/1.1 200 OK Server: nginx/1.24.0 Date: Tue, 24 Oct 2023 13:07:27 GMT Content-Type: image/jpeg Content-Length: 647023 Last-Modified: Fri, 15 Sep 2023 06:06:10 GMT Connection: keep-alive ETag: 6503f452-9df6f Accept-Ranges: bytes不加none a服务器的配置文件 /etc/nginx/conf.d/default.confserver {listen 80;server_name localhost;location /{root /usr/share/nginx/html; index 1.jpg;valid_referers blocked www.jd.com; if ($invalid_referer) {return 502;} } }访问a服务器的网站 因此 none只是决定能不能访问a服务器本身加none可以访问a服务器本身不加none不可以访问a服务器本身。 blocked 本身含义是允许开头不带http的访问成功那就意味着 带http的访问不成功 配置a服务器的配置文件 server {listen 80;server_name localhost;location /{root /usr/share/nginx/html; index 1.jpg;valid_referers blocked 192.168.231.174; if ($invalid_referer) {return 502;} } }访问www与http://www   后者就不可以访问 [rootdaili ~]# curl -e http://www.jd.com -Ik 192.168.231.171 HTTP/1.1 502 Bad Gateway Server: nginx/1.24.0 Date: Mon, 23 Oct 2023 13:02:34 GMT Content-Type: text/html Content-Length: 157 Connection: keep-alive[rootdaili ~]# curl -e www.jd.com -Ik 192.168.231.171 HTTP/1.1 200 OK Server: nginx/1.24.0 Date: Mon, 23 Oct 2023 13:02:37 GMT Content-Type: image/jpeg Content-Length: 647023 Last-Modified: Fri, 15 Sep 2023 06:06:10 GMT Connection: keep-alive ETag: 6503f452-9df6f Accept-Ranges: bytes情况2 加*.jd.com server {listen 80;server_name localhost;location /{root /usr/share/nginx/html;valid_referers none blocked *.jd.com ;index 1.jpg; } }[rootdaili ~]# curl -e http://www.jd.com -Ik 192.168.231.174 HTTP/1.1 200 OK Server: nginx/1.24.0 Date: Tue, 24 Oct 2023 13:31:52 GMT Content-Type: image/jpeg Content-Length: 647023 Last-Modified: Fri, 15 Sep 2023 06:06:10 GMT Connection: keep-alive ETag: 6503f452-9df6f Accept-Ranges: bytes[rootdaili ~]# curl -e www.jd.com -Ik 192.168.231.174 HTTP/1.1 200 OK Server: nginx/1.24.0 Date: Tue, 24 Oct 2023 13:32:00 GMT Content-Type: image/jpeg Content-Length: 647023 Last-Modified: Fri, 15 Sep 2023 06:06:10 GMT Connection: keep-alive ETag: 6503f452-9df6f Accept-Ranges: bytes这里虽然配置文件里面写了blocked但是白名单里面定义的是*.jd.com,因此他有俩个 一个是www开头一个是http://  因此访问http://jd.com 可以访问 server {listen 80;server_name localhost;location /{root /usr/share/nginx/html;valid_referers none blocked www.jd.com ;index 1.jpg; } }[rootdaili ~]# curl -e www.jd.com -Ik 192.168.231.174 HTTP/1.1 200 OK Server: nginx/1.24.0 Date: Tue, 24 Oct 2023 13:35:17 GMT Content-Type: image/jpeg Content-Length: 647023 Last-Modified: Fri, 15 Sep 2023 06:06:10 GMT Connection: keep-alive ETag: 6503f452-9df6f Accept-Ranges: bytes[rootdaili ~]# curl -e http://www.jd.com -Ik 192.168.231.174 HTTP/1.1 200 OK Server: nginx/1.24.0 Date: Tue, 24 Oct 2023 13:35:19 GMT Content-Type: image/jpeg Content-Length: 647023 Last-Modified: Fri, 15 Sep 2023 06:06:10 GMT Connection: keep-alive ETag: 6503f452-9df6f Accept-Ranges: bytes这里尽管定义配置的是www.jd.com 按道理输入http://jd.com 是访问不了的但是在配置文件里面location是在server下的而server是在http下面的因此输入http://jd.com 也是可以访问的。 相同那么加了blocked 由于 白名单里面没有baidu.com 因此 访问www.baidu.com可以访问访问http://www.baidu.com 就不可以访问。 [rootlocalhost conf.d]# curl -e www.baidu.com -Ik 192.168.231.174 HTTP/1.1 200 OK Server: nginx/1.24.0 Date: Tue, 24 Oct 2023 13:57:27 GMT Content-Type: image/jpeg Content-Length: 647023 Last-Modified: Fri, 15 Sep 2023 06:06:10 GMT Connection: keep-alive ETag: 6503f452-9df6f Accept-Ranges: bytes[rootlocalhost conf.d]# curl -e http://www.baidu.com -Ik 192.168.231.174 HTTP/1.1 502 Bad Gateway Server: nginx/1.24.0 Date: Tue, 24 Oct 2023 13:57:32 GMT Content-Type: text/html Content-Length: 157 Connection: keep-alive
http://www.hkea.cn/news/14366765/

相关文章:

  • 做php网站h5快速建站
  • 焦作公司做网站一个网站开发需要多久
  • 上海的做网站的公司17一起做网店
  • 哪些网站可以加锚文本四川建设厅特种工报名网站
  • 郑州做网站公司中小程序登录密码怎么找回
  • 做app网站公司名称网站建设服务领域
  • 网站用户需求如何利用国外分类网站开发客户
  • 建设银行此网站的安全证书有问题.公司网站可以免费建吗
  • 大型网站快速排名wordpress怎么设置语言设置中文
  • php 资讯网站网站编辑 seo
  • 网页设计教程网站交易网站seo怎么做
  • 网站运营与管理的内容有哪些wordpress缓存问题
  • 哪个网站做布料好炫酷的企业网站
  • 湘阴网站设计建站公司用哪家服务器
  • 服装设计最好的出路企业网站优化哪家好
  • 推荐邵阳网站建设郑州国外网站建设
  • 私人订制网站建设视频直播sdk快速接入
  • 购物网站功能详细介绍湖南天辰建设责任公司网站
  • 做网站会员登陆如何做二级域名网站
  • 公司网站上传图库兴义哪有做网站
  • 建站宝盒模板dw做的网站后台是什么
  • 行业网站排行榜绛县苗木网网站是由谁建设的
  • 网站规划建设与管理维护企业邮箱怎么改密码
  • 装修建材网站黄浦区网站建设公司
  • 常德网站建设案例展示老薛主机怎么安装wordpress
  • 网站软文推广范文做网站开发的有哪些公司
  • python 网站建设红河网络营销
  • 罗湖网站设计开发静态网站案例
  • 上海网站建设哪家做得好厦门网站关键词优化
  • 东营市城市和建设管理局网站百度网址是多少