<?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; 如何限制通过固定的IP访问阿里云OSS的文件</title>
	<atom:link href="https://www.fuwuqiok.com/tag/%e5%a6%82%e4%bd%95%e9%99%90%e5%88%b6%e9%80%9a%e8%bf%87%e5%9b%ba%e5%ae%9a%e7%9a%84ip%e8%ae%bf%e9%97%ae%e9%98%bf%e9%87%8c%e4%ba%91oss%e7%9a%84%e6%96%87%e4%bb%b6/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fuwuqiok.com</link>
	<description></description>
	<lastBuildDate>Sun, 01 Mar 2020 07:28:40 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.26</generator>
	<item>
		<title>如何限制通过固定的IP访问阿里云OSS的文件</title>
		<link>https://www.fuwuqiok.com/%e5%a6%82%e4%bd%95%e9%99%90%e5%88%b6%e9%80%9a%e8%bf%87%e5%9b%ba%e5%ae%9a%e7%9a%84ip%e8%ae%bf%e9%97%ae%e9%98%bf%e9%87%8c%e4%ba%91oss%e7%9a%84%e6%96%87%e4%bb%b6/</link>
		<comments>https://www.fuwuqiok.com/%e5%a6%82%e4%bd%95%e9%99%90%e5%88%b6%e9%80%9a%e8%bf%87%e5%9b%ba%e5%ae%9a%e7%9a%84ip%e8%ae%bf%e9%97%ae%e9%98%bf%e9%87%8c%e4%ba%91oss%e7%9a%84%e6%96%87%e4%bb%b6/#comments</comments>
		<pubDate>Sat, 15 Aug 2015 04:19:19 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[aliyun服务器代维]]></category>
		<category><![CDATA[服务器迁移]]></category>
		<category><![CDATA[网站代维]]></category>
		<category><![CDATA[aws代维]]></category>
		<category><![CDATA[aws服务器代维]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[如何限制通过固定的IP访问阿里云OSS的文件]]></category>
		<category><![CDATA[小说站代维]]></category>
		<category><![CDATA[阿里云代维]]></category>

		<guid isPermaLink="false">https://www.fuwuqiok.com/?p=2569</guid>
		<description><![CDATA[<p>最近有客户提出需求，在某些情况，需要使用OSS来存大量文件，但是请求这些文件时候需要访问固定的IP（比如程序之 [&#8230;]</p>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/%e5%a6%82%e4%bd%95%e9%99%90%e5%88%b6%e9%80%9a%e8%bf%87%e5%9b%ba%e5%ae%9a%e7%9a%84ip%e8%ae%bf%e9%97%ae%e9%98%bf%e9%87%8c%e4%ba%91oss%e7%9a%84%e6%96%87%e4%bb%b6/">如何限制通过固定的IP访问阿里云OSS的文件</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>最近有客户提出需求，在某些情况，需要使用OSS来存大量文件，但是请求这些文件时候需要访问固定的IP（比如程序之前写死了IP，比如和运营商谈免流量的问题，公司跳板机，固定公司ip访问限制）</p>
<div>通过查看阿里云服务器手册发现oss的服务是由多个IP的，并且随时可能变化，因此如果要实现这个功能，这时候可以通过ECS搭建反向代理来实现需求</div>
<div></div>
<div>nginx配置如下：</div>
<p>server {<br />
listen       80 default_server;<br />
server_name  _;<br />
location / {<br />
proxy_pass http://xxx.oss-cn-qingdao-internal.aliyuncs.com/;<br />
proxy_set_header   Referer             http://www.test.com;<br />
}<br />
}</p>
<div>这里通过ECS代理OSS的内网，从而省掉了OSS的流量费，但是访问效率需要依赖ECS的带宽</div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2015/08/Image.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2015/08/Image.png" alt="Image" width="669" height="220" /></a></div>
<div>为了安全，OSS配置了refer限制，也可以通过proxy_set_header来代理发送一个refer，这个refer可以设置一个随意别人不知道的值，能够变相实现加密（只有ECS服务器知道这个refer值）</div>
<div> 配置完毕之后，就可以通过访问ECS来访问到OSS上的文件了，比如：</div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2015/08/aaa.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2015/08/aaa.png" alt="aaa" width="408" height="136" /></a></div>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/%e5%a6%82%e4%bd%95%e9%99%90%e5%88%b6%e9%80%9a%e8%bf%87%e5%9b%ba%e5%ae%9a%e7%9a%84ip%e8%ae%bf%e9%97%ae%e9%98%bf%e9%87%8c%e4%ba%91oss%e7%9a%84%e6%96%87%e4%bb%b6/">如何限制通过固定的IP访问阿里云OSS的文件</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.fuwuqiok.com/%e5%a6%82%e4%bd%95%e9%99%90%e5%88%b6%e9%80%9a%e8%bf%87%e5%9b%ba%e5%ae%9a%e7%9a%84ip%e8%ae%bf%e9%97%ae%e9%98%bf%e9%87%8c%e4%ba%91oss%e7%9a%84%e6%96%87%e4%bb%b6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
