robots 、http referer

本文介绍了robots文件的作用,即允许搜索引擎如百度、Google等进行抓取。同时解释了HTTPReferer作为header的一部分,在浏览器向服务器发送请求时携带的信息,用于告知服务器请求来源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

引用:http://tech.huanqiu.com/internet/2012-08/3080369.html

robots文件允许了百度、Google、搜狗、搜搜等搜索抓取

HTTP Referer是header的一部分,当浏览器向网站服务器发送请求的时候,一般会带上Referer(访问来源),告诉服务器是从哪个页面链接过来,服务器籍此可获得信息用于处理

location ^~ /file-api/ { proxy_pass http://file-api/; include /apps/openresty/nginx/conf/vhosts/common-x-form.conf; include /apps/openresty/nginx/conf/vhosts/common-proxy.conf; } location ~ ^/file/((?:sm9pS0sF6oK|24Gy8U0OlRbQ)/.*) { set $sign_path $1; valid_referers test-wb.gboss.tech test-console.gmarketing.tech test-sw.ceboss.cn ; if ($invalid_referer) { add_header X-Debug-Reason "Forbidden Referer" always; return 403; } secure_link $arg_sign,$arg_t; secure_link_md5 "$arg_t$sign_path q8xyMiuJJAomkrk"; if ($secure_link = "") { add_header X-Debug-Reason "Signature Required or Invalid" always; return 403; } if ($secure_link = "0") { add_header X-Debug-Reason "Link Expired" always; return 410; } rewrite ^/file/(.*)$ /$1 break; root /data/share/files; include /apps/openresty/nginx/conf/vhosts/file-from.conf; } location /file/ { rewrite ^/file/(.*)$ /$1 break; root /data/share/files; include /apps/openresty/nginx/conf/vhosts/file-from.conf; } location /robots.txt { alias /data/vue/robots/robots.txt; add_header Content-Type text/plain; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ location ^~ /file-api/ { proxy_pass http://file-api/; include /apps/openresty/nginx/conf/vhosts/common-x-form.conf; include /apps/openresty/nginx/conf/vhosts/common-proxy.conf; } location ~ ^/file/((?:sm9pS0sF6oK|24Gy8U0OlRbQ)/.*) { set $sign_path $1; valid_referers test-wb.gboss.tech test-console.gmarketing.tech test-sw.ceboss.cn ; if ($invalid_referer) { add_header X-Debug-Reason "Forbidden Referer" always; return 403; } secure_link $arg_sign,$arg_t; secure_link_md5 "$arg_t$sign_path q8xyMiuJJAomkrk"; if ($secure_link = "") { add_header X-Debug-Reason "Signature Required or Invalid" always; return 403; } if ($secure_link = "0") { add_header X-Debug-Reason "Link Expired" always; return 410; } rewrite ^/file/(.*)$ /$1 break; root /data/share/files; include /apps/openresty/nginx/conf/vhosts/file-from.conf; } location /file/ { rewrite ^/file/(.*)$ /$1 break; root /data/share/files; include /apps/openresty/nginx/conf/vhosts/file-from.conf; } location /robots.txt { alias /data/vue/robots/robots.txt; add_header Content-Type text/plain; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 对比两个nginx配置,有何区别,为什么第一个配置可以正常使用。
最新发布
06-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值