<?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>nginx替换内容 &#8211; moneyslow.com</title>
	<atom:link href="https://moneyslow.com/tag/nginx%e6%9b%bf%e6%8d%a2%e5%86%85%e5%ae%b9/feed" rel="self" type="application/rss+xml" />
	<link>https://moneyslow.com</link>
	<description>making money with technology</description>
	<lastBuildDate>Mon, 12 Jul 2021 10:25:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
	<item>
		<title>Nginx代理网站替换内容的字符编码和节省流量问题解决办法</title>
		<link>https://moneyslow.com/nginx%e4%bb%a3%e7%90%86%e7%bd%91%e7%ab%99%e6%9b%bf%e6%8d%a2%e5%86%85%e5%ae%b9%e7%9a%84%e5%ad%97%e7%ac%a6%e7%bc%96%e7%a0%81%e5%92%8c%e8%8a%82%e7%9c%81%e6%b5%81%e9%87%8f%e9%97%ae%e9%a2%98%e8%a7%a3.html</link>
		
		<dc:creator><![CDATA[moneyslow]]></dc:creator>
		<pubDate>Fri, 08 Jan 2021 05:32:39 +0000</pubDate>
				<category><![CDATA[newest]]></category>
		<category><![CDATA[nginx代理节省流量]]></category>
		<category><![CDATA[nginx代理配置]]></category>
		<category><![CDATA[nginx替换内容]]></category>
		<category><![CDATA[互联网赚钱]]></category>
		<guid isPermaLink="false">https://moneyslow.com/?p=12402</guid>

					<description><![CDATA[1、代理一个网站： location / { proxy_pass http://www.moneyslow.com/; } 2 替换一些内容 location / { # 必须设置，不然www.moneyslow.com返回的是gzip压缩过的内容 proxy_set_header Accept-Encoding ""; proxy_pass http://www.moneyslow.com/; # 使用sub模块 sub_filter_once off; # 可用替换多次 sub_filter "海阔中文网" "慢慢赚钱新闻"; # 把 海阔中文网 替换成 慢慢赚钱新闻 sub_filter "NBA" "NBC"; # 把 NBA 替换成 NBC } 注意事项：如果只有“NBA”替换成“NBC”成功了，“海阔中文网”替换成“慢慢赚钱新闻”失败了，这个问题要处理字符编码问题，打开Chrome浏览器的调试窗口，服务器返回的内容经过了gzip压缩，内容编码为GB2312，gzip压缩的问题我们用 proxy_set_header Accept-Encoding “”; 指令解决了。对于编码问题，由于配置文件的编码为UTF-8，网页内容编码为GB2312，所以对于中文，编码不一样，无法用“慢慢赚钱新闻”替换“海阔中文网”。把配置文件夹保存为GBK（兼容GB2312）试下。 3 通过两次proxy_pass节省流量 在上一步中，我们需要用 proxy_set_header Accept-Encoding “”;配置指令，以便让www.moneyslow.com返回解压缩后的内容，以方便内容替换。这种做法会增加网络流量，更好的方法：用两次proxy_pass，第一次是向远程服务器，获取到的是gzip压缩的内容，第二次是内部proxy_pass，获取到解压后的内容。 location / [&#8230;]]]></description>
		
		
		
			</item>
	</channel>
</rss>
