<?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>软路由 &#8211; 老丁的博客</title>
	<atom:link href="https://www.laoding.me/archives/tag/%E8%BD%AF%E8%B7%AF%E7%94%B1/feed" rel="self" type="application/rss+xml" />
	<link>https://www.laoding.me</link>
	<description></description>
	<lastBuildDate>Fri, 25 Oct 2024 09:50:55 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://public-123.oss-cn-guangzhou.aliyuncs.com/2024/09/cropped-图片_20240927133356-768x768-1-32x32.jpg</url>
	<title>软路由 &#8211; 老丁的博客</title>
	<link>https://www.laoding.me</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>如何用Nginx为网站配置多个代理服务器</title>
		<link>https://www.laoding.me/archives/813</link>
					<comments>https://www.laoding.me/archives/813#respond</comments>
		
		<dc:creator><![CDATA[laoding]]></dc:creator>
		<pubDate>Fri, 25 Oct 2024 09:50:55 +0000</pubDate>
				<category><![CDATA[办公网络]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[内网穿透]]></category>
		<category><![CDATA[软路由]]></category>
		<guid isPermaLink="false">https://www.laoding.me/?p=813</guid>

					<description><![CDATA[1.使用场景 有时我们需要在不同的地区访问服务器的网站，或是访问内网中的路由器，利用中转服务器可以提高访问目标 [&#8230;]]]></description>
										<content:encoded><![CDATA[<h3>1.使用场景</h3>
<p>有时我们需要在不同的地区访问服务器的网站，或是访问内网中的路由器，利用中转服务器可以提高访问目标网站的速度。本文中就是利用中转服务器访问内网路由器的操作过程</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-814" src="https://public-123.oss-cn-guangzhou.aliyuncs.com/2024/10/20241025094011234.png?x-oss-process=image/auto-orient,1/quality,q_90/format,webp" alt="" width="934" height="369" /></p>
<h3>2.准备工作</h3>
<ul>
<li>内网路由器已经完成了内网穿透，可通过端口号访问，如：***.abc.com:8001</li>
<li>公网服务器部署好Nginx服务</li>
</ul>
<h3>3.Nginx配置</h3>
<p>在 nginx中<code>server</code> 块的外部定义一个 <code>upstream</code> 组，包含两个目标服务器。</p>
<pre class="code">http {
include mime.types; 
default_type application/octet-stream; 
…… 
gzip on; 
gzip_min_length 1k; 
gzip_buffers 4 16k; 
……
upstream backend_servers {
   server 127.0.0.1:6009;
   server nps2.e-123.cn:19008;
 }

}</pre>
<p><code>upstream</code> 组一定要加在http里面</p>
<h3>4.反向代理配置</h3>
<pre class="code">location ^~ / {
  proxy_pass http://backend_servers;
  proxy_set_header Host $host; 
  ……
}</pre>
<h3>5. 配置负载均衡策略（可选）</h3>
<p>默认情况下，Nginx 会使用 <code>轮询（round-robin）</code> 算法在两个服务器之间均衡请求。如果想调整策略，比如指定权重或设置为 <code>备用</code>，可以在 <code>upstream</code> 中配置：</p>
<pre class="code">upstream backend_servers {
  server 127.0.0.1:6009 weight=2; # 设置权重
  server ***.e-123.cn:19008 backup; # 设置为备用
}</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.laoding.me/archives/813/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
