<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://thefoxofsky.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://thefoxofsky.github.io/" rel="alternate" type="text/html" /><updated>2025-05-26T19:26:35-07:00</updated><id>https://thefoxofsky.github.io/feed.xml</id><title type="html">Jingkai’s Home Page</title><subtitle>Ph.D candidate at South China University of Technology. Mainly interested in Object Detection.</subtitle><author><name>Jingkai Zhou</name><email>fs.jingkaizhou@gmail.com</email></author><entry><title type="html">外网跳转服务器配置笔记</title><link href="https://thefoxofsky.github.io/%E5%A4%96%E7%BD%91%E8%B7%B3%E8%BD%AC%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE%E7%AC%94%E8%AE%B0/" rel="alternate" type="text/html" title="外网跳转服务器配置笔记" /><published>2019-10-09T00:00:00-07:00</published><updated>2019-10-09T00:00:00-07:00</updated><id>https://thefoxofsky.github.io/%E5%A4%96%E7%BD%91%E8%B7%B3%E8%BD%AC%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE%E7%AC%94%E8%AE%B0</id><content type="html" xml:base="https://thefoxofsky.github.io/%E5%A4%96%E7%BD%91%E8%B7%B3%E8%BD%AC%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE%E7%AC%94%E8%AE%B0/"><![CDATA[<p>1、买个阿里云或腾讯云，装自带的Ubuntu镜像</p>

<p>2、现在我们有两个服务器，分别是跳板服务器（买的云服务器）和内网服务器（学校的服务器）</p>

<h3 id="跳转服务器操作">跳转服务器操作：</h3>

<p>1、修改 frps.ini 文件，配置一个名为 ssh 的反向代理：</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># frps.ini</span>
<span class="o">[</span>common]
bind_port <span class="o">=</span> 7000

<span class="o">[</span>ssh]
listen_port <span class="o">=</span> 2222
auth_token <span class="o">=</span> 123
</code></pre></div></div>

<p>2、开通所有跳板服务器的tcp端口。特别的对于阿里云，在防火墙那里开即可。</p>

<p>3、启动 frps：</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./frps <span class="nt">-c</span> ./frps.ini
</code></pre></div></div>

<h3 id="内网服务器操作">内网服务器操作：</h3>

<p>1、修改 frpc.ini 文件，设置 frps 所在服务器的 IP 为 x.x.x.x；</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># frpc.ini</span>
<span class="o">[</span>common]
server_addr <span class="o">=</span> x.x.x.x
server_port <span class="o">=</span> 7000
auth_token <span class="o">=</span> 123

<span class="o">[</span>ssh]
local_ip <span class="o">=</span> 127.0.0.1
local_port <span class="o">=</span> 22
remote_port <span class="o">=</span> 2222
启动 frpc：

./frpc <span class="nt">-c</span> ./frpc.ini
</code></pre></div></div>

<p>2、我们使用Linux下常用的进程管理器supervisor来管理FRP服务。</p>

<p>首先需要安装supervisor。</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>supervisor
</code></pre></div></div>

<p>然后在/etc/supervisor/conf.d下新建一个配置文件frp.conf，输入以下内容。command应该是你放置frp软件的位置。</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">[</span>program:frp]

<span class="nb">command</span> <span class="o">=</span> /home/fsfire/Software/frp/frpc <span class="nt">-c</span> /home/fsfire/Software/frp/frpc.ini

autostart <span class="o">=</span> <span class="nb">true</span>
</code></pre></div></div>

<p>然后启动supervisor，如果事先已经安装好了supervisor那么就重新启动。之后查看一下supervisor的运行状态，看看frp是否已在运行。</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#重启supervisor</span>

<span class="nb">sudo </span>systemctl restart supervisor

<span class="c"># 查看supervisor运行状态</span>

<span class="nb">sudo </span>supervisorctl status
</code></pre></div></div>

<hr />

<p>配好之后可以通过</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh （跳板服务器ip） -p （不常用的端口2）
</code></pre></div></div>

<p>来访问内网服务器</p>]]></content><author><name>Jingkai Zhou</name><email>fs.jingkaizhou@gmail.com</email></author><summary type="html"><![CDATA[1、买个阿里云或腾讯云，装自带的Ubuntu镜像]]></summary></entry></feed>