如何配置apache以在同一台机器上同时提供RoR和Flask?

时间:2022-01-08 13:47:31

I have a dedicated machine I use for testing. At the moment it's running a Rails (2.3) app over Apache and Passenger. I would also like to simultaneously serve a Flask application using the same machine and a different url if possible. Here's what I currently have for my httpd.conf file:

我有一台专门用于测试的机器。目前它正在运行Apache和Passenger的Rails(2.3)应用程序。如果可能的话,我还想同时使用相同的机器和不同的URL来提供Flask应用程序。这是我目前为httpd.conf文件提供的内容:

<VirtualHost *:80>
  DocumentRoot /path/to/rails-app/public
  PassengerDefaultUser railsuser
  RailsEnv testing
  # .. some misc apache config
</VirtualHost>

How should I modify it to serve two different urls (on a local network) with one serving the Rails app and the other serving Flask? Thanks.

我应该如何修改它以提供两个不同的网址(在本地网络上),一个服务Rails应用程序,另一个服务Flask?谢谢。

1 个解决方案

#1


1  

In your OP, you're setting the handling for the default url.

在您的OP中,您正在设置默认网址的处理。

For your second virtual web server, just use a specific host name in the config that is a second host name for the same machine. This is called "name-based" virtual hosting. See wikipedia.

对于第二个虚拟Web服务器,只需在配置中使用特定主机名,该主机名是同一台计算机的第二个主机名。这称为“基于名称”的虚拟主机。见*。

Remember that multiple hostnames can resolve to the same IP address.

请记住,多个主机名可以解析为相同的IP地址。

You can use the full dns system if you want, just specify your local network address (192.168.xxx) -- the url will not work for machines not on your local network.

如果需要,可以使用完整的DNS系统,只需指定本地网络地址(192.168.xxx) - 该URL不适用于不在本地网络上的计算机。

More info will be available at the webmasters SO site.

更多信息将在网站管理员SO网站上提供。

A post with instructions

有说明的帖子

#1


1  

In your OP, you're setting the handling for the default url.

在您的OP中,您正在设置默认网址的处理。

For your second virtual web server, just use a specific host name in the config that is a second host name for the same machine. This is called "name-based" virtual hosting. See wikipedia.

对于第二个虚拟Web服务器,只需在配置中使用特定主机名,该主机名是同一台计算机的第二个主机名。这称为“基于名称”的虚拟主机。见*。

Remember that multiple hostnames can resolve to the same IP address.

请记住,多个主机名可以解析为相同的IP地址。

You can use the full dns system if you want, just specify your local network address (192.168.xxx) -- the url will not work for machines not on your local network.

如果需要,可以使用完整的DNS系统,只需指定本地网络地址(192.168.xxx) - 该URL不适用于不在本地网络上的计算机。

More info will be available at the webmasters SO site.

更多信息将在网站管理员SO网站上提供。

A post with instructions

有说明的帖子