使用 nginx 进行反向代理,并且使用非443端口进行 https 通信,并且仅允许内网IP访问web页面(公网只能访问webdav) #6590
VergilGao
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
alist.conf:
解释一下:
首先是非标准https配置
这样就保证了即使你通过
http://alist.example.com:5244
这样的方式访问,也会跳转到 https然后是 location 段:
在
location /
段里,配置了:这段的意思是拒绝除了内网IP内的其他所有IP的访问。
这样,我们的alist只能在局域网内访问。
但是如果我还想在公网通过webdav访问呢?比如我们用印象笔记之类的软件,会将笔记存储在webdav上,在这里我就可以把alist作为一个webdav服务器用了。
所以就有了
location /dav
段:在这段里,因为我们没有配置ip访问规则,所以无论什么来源的IP都能进行访问。
需要注意的是,我们这里的nginx服务器是直接对外服务的,如果你内网还有其他nginx服务器再进行转发,那就不在我这个帖子讨论的范畴之内了。
但是这样其实有一个很幽默的效果,就是假设你家IP地址是
1.1.1.1
,然后别人通过http://1.1.1.1:5244
访问,会直接跳转到https://alist.example.com:5244
但是很多人其实是想防止别人以纯IP:端口的方式扫描来获取到域名的,你需要再配置一个 reject.confBeta Was this translation helpful? Give feedback.
All reactions