<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>系统运维 &#187; 防盗链</title>
	<atom:link href="http://www.osyunwei.com/archives/tag/%E9%98%B2%E7%9B%97%E9%93%BE/feed" rel="self" type="application/rss+xml" />
	<link>https://www.osyunwei.com</link>
	<description>国产化OS/AnolisOS/openEuler/RHEL/CentOS/Rocky Linux/Debian/Ubuntu Linux FreeBSD 服务器教程 &#124; Windows Server 2003/2008/2012/2016/2019/2022/2025服务器教程</description>
	<lastBuildDate>Tue, 14 Apr 2026 10:59:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nginx设置图片防盗链</title>
		<link>https://www.osyunwei.com/archives/5431.html</link>
		<comments>https://www.osyunwei.com/archives/5431.html#comments</comments>
		<pubDate>Fri, 19 Oct 2012 07:48:20 +0000</pubDate>
		<dc:creator>qihang01</dc:creator>
				<category><![CDATA[LNMP]]></category>
		<category><![CDATA[防盗链]]></category>

		<guid isPermaLink="false">http://www.osyunwei.com/?p=5431</guid>
		<description><![CDATA[说明： 站点1：bbs.osyunwei.com 站点2：sns.osyunwei.com 站点1的nginx配置文件路径：/usr/local/nginx/conf/vhost/bbs.osyunwei.com.conf 站点1下面的图片路径：http://bbs.osyunwei.com/osyunwei.jpg 系统运维 www.osyunwei.com 温馨提醒：qihang01原创内容©版权所有,转载请注明出处及原文链接 站点2下面的网页文件路径：http://sns.osyunwei.com/nginx.html nginx.html文件代码 &#60;title&#62;nginx图片防盗链&#60;/title&#62; &#60;/head&#62; &#60;body&#62; &#60;img src="http://bbs.osyunwei.com/osyunwei.jpg" width="791" height="510" /&#62; &#60;/body&#62; &#60;/html&#62; 打开站点2的nginx.html页面如下图所示： 系统运维 www.osyunwei.com 温馨提醒：qihang01原创内容©版权所有,转载请注明出处及原文链接 实现目的：禁止站点1下面的图片被站点2引用，即对站点1的图片实现防盗链 具体操作： 1、上传一张预先准备好的盗链警告图片到站点1目录下 http://bbs.osyunwei.com/www.osyunwei.com.gif 如下图所示 2、vi /usr/local/nginx/conf/vhost/bbs.osyunwei.com.conf #编辑，在server { 段里面添加以下代码 location ~* .(jpg&#124;png&#124;swf&#124;flv)$ { valid_referers none blocked bbs.osyunwei.com ; if ($invalid_referer) { #return 403; rewrite ^/ http://bbs.osyunwei.com/www.osyunwei.com.gif; } } :wq! #保存退出 [...]<p><a rel="bookmark" href="https://www.osyunwei.com/archives/5431.html" target="_blank">查看全文</a></p>]]></description>
		<wfw:commentRss>https://www.osyunwei.com/archives/5431.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
