在云服务器上搭建Nginx反向代理、结合frp进行内网穿透,并将真实IP传递给内网Nginx的过程,可以大致分为以下几个步骤:
一、准备工作
- 云服务器:确保你有一台具有公网IP的云服务器,用于部署Nginx和frp的服务端(frps)。
- 内网服务器:内网中需要有一台服务器,用于部署Nginx和frp的客户端(frpc)。
- frp软件:从frp的GitHub发布页面下载适合你的操作系统版本的frp软件。
大约 3 分钟
在云服务器上搭建Nginx反向代理、结合frp进行内网穿透,并将真实IP传递给内网Nginx的过程,可以大致分为以下几个步骤:
要实现frps(FRP服务端)的后台运行,有几种常见的方法,这些方法可以帮助你在Linux系统环境下,让frps服务在后台持续运行,即使终端关闭或用户注销也不会影响服务的运行。以下是几种主要的实现方式:
nohup命令用于在用户注销或终端关闭后继续运行相应的命令。你可以通过以下命令格式来启动frps服务,并将其输出重定向到文件中,以便后续查看日志:
nohup /path/to/frps -c /path/to/frps.ini >/dev/null 2>&1 &
在frp(Fast Reverse Proxy)的配置中,虽然WebSocket通常被视为TCP连接上的协议,但你可以通过frp的TCP转发功能来间接地实现WebSocket服务的custom_domains
配置。不过,需要注意的是,frp本身并不直接支持在TCP类型的转发中直接使用custom_domains
(这个参数更多用于HTTP/HTTPS类型的转发)。然而,你可以通过一些方法来实现类似的效果。
以下是一种可能的解决方案,用于通过frp将WebSocket服务暴露到公网,并间接地通过域名访问:
import pandas as pd
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
#import numpy and pandas package
import numpy as np
import pandas as pd
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
ms = pd.read_csv('data/microsoft.csv',index_col=0)
ms.index=pd.to_datetime(ms.index)
ms.head()
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
# To recall, this is the code to mimic the roll dice game for 50 times
die = pd.DataFrame([1, 2, 3, 4, 5, 6])
trial = 50
results = [die.sample(2, replace=True).sum().loc[0] for i in range(trial)]
# This is the code for summarizing the results of sum of faces by frequency
freq = pd.DataFrame(results)[0].value_counts()
sort_freq = freq.sort_index()
print(sort_freq)
import pandas as pd
import numpy as np
from scipy.stats import norm
ms = pd.read_csv('data/microsoft.csv',index_col=0)
ms.index=pd.to_datetime(ms.index)
ms.head()