我有一个运行Ubuntu14.04.4LTS的个人机器。我用它来主持一个团队演讲,一个我的服务器和一个网站。
我试图使子域只指向正确的服务。所以,例如
使用panel.example.com只会指向https://localhost:8000 (CP ),通过使用DNS重定向(而不是A记录)使CP面板得到排序
使用mc.example.com只会指向localhost:25565 (我的服务器)
使用ts.example.com只会指向localhost:9987 (Teamspeak )
使用example.com只会指向网站(example.com/forums /index.php)
我成功地做到了这一点,至少对于通过web浏览器使用这个httpd.conf的连接:
<VirtualHost *:80>
ServerName mc.example.com
redirect / localhost:25565
</VirtualHost>
<VirtualHost *:80>
ServerName ts.example.com
redirect / localhost:9987
</VirtualHost>但这只适用于来自网络浏览器的连接,如果我试图使用任何子域或域名连接团队语言,它仍然连接.
这可能是无用的,我应该使用域名,但我想要进行一些排序。
这能做到吗?
据我所知,这与IPTables有关,但老实说,我一点也不知道。像这样吗?
iptables coming from any ip:25565 to anything else than localhost:25565 Drop
iptables coming from any ip:9987 to anything else than localhost:9987 Drop
iptables coming from any ip:80 to anything else than localhost:80/8000 Drop我说的对吗?
发布于 2016-06-12 19:19:51
您创建的IPTABLE规则将拒绝所有通信,并删除它们。那些apache规则也是无用的。
我认为,要做到这一点,唯一的方法就是向Linux服务器添加3个虚拟网络适配器,然后每个适配器都有一个有效的外部IP地址。您可以将DNS配置为将每个域名指向4个IP地址之一。
“我的世界”应该绑定到externalIP4 1:25565,Teamspeak绑定到externalIP4 2:9987,CPannel绑定到externalIP3,最后,Apache 4:80。
当我说“绑定”时,我指的是应用程序必须配置为侦听特定IP,而不是任何IP (这是大多数应用程序的默认行为)。
https://unix.stackexchange.com/questions/289326
复制相似问题