在 VirtualBox 中为 Fedora Red Hat 24 上的 Meteor 打开一个端口

Open a port for Meteor on Fedora Red Hat 24 in VirtualBox

我在 VirtualBox 中 运行ning Fedora 24 服务器,在端口 80 上使用 Apache 运行ning。我想打开端口 3000 以便我可以 运行 一个 Meteor 站点在同一个虚拟服务器上。

我已经尝试使用 CLI 命令 firewall-c md --zone=public --add-port=3000/tcp --permanent,从表面上看,这似乎有效:

#firewall-cmd --zone=public --list-ports
80/tcp
# firewall-cmd --zone=public --add-port=3000/tcp --permanent
success
# systemctl restart firewalld
# firewall-cmd --zone=public --list-ports
3000/tcp 80/tcp

位于 10.0.0.30 的 Fedora 服务器报告 Meteor 应用正在 运行ning ...

App running at: http://localhost:3000/

...但是当我从主机中的浏览器连接时,我收到一条通知:

This site can’t be reached

http://10.0.0.30:3000/ is unreachable.

当我连接到普通版 http://10.0.0.30 时,Apache 网站清晰可见。

我能做些什么来解决这个问题?


编辑:

/etc/selinux/config/ 看起来像这样,但即使禁用它,问题也没有解决:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

我还没有解决防火墙问题,但现在我有一个解决方法。

根据@MikeKing 的建议,并使用 Jsaac here 给出的建议,我在 VirtualBox 中的 Fedora 实例 运行 的 /etc/httpd/conf/httpd.conf 末尾添加了以下内容:

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /var/www/html
    ServerName apache
</VirtualHost>

<VirtualHost *:80>
    ServerName meteor
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
</VirtualHost>

我在主机上编辑了 /etc/hosts/ 文件:

127.0.0.1   localhost
10.0.0.30   apache 
10.0.0.30   meteor

现在(至少在我的机器上)url http://apache/ opens the site served by Apache and http://meteor/ 在端口 3000 上打开 Meteor 应用 运行。