我有一台运行rails 3.2应用程序的服务器。它在端口3000上运行瘦服务器,在443上运行apache(代理)服务器。
如果我尝试在同一台服务器上托管另一个rails应用程序,可能是通过在/ www下创建一个文件夹并使其在端口3002或其他任何其他端口上运行,然后在其他端口上运行另一个apache用于代理吗?
我创建的新rails应用程序在Rails 4中使用Ruby 2.0
请指导。
答案 0 :(得分:1)
为端口3002添加另一个VirtualHost
<VirtualHost *:3002>
ServerName your-server-name
DocumentRoot /www/your-second-app-public-folder-path
<Directory /www/your-second-app-public-folder-path>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
答案 1 :(得分:0)
使用主机虚拟主机配置为同一个ip指定不同的端口
You have multiple domains going to the same IP and also want to serve multiple ports. By defining the ports in the "NameVirtualHost" tag, you can allow this to work. If you try using <VirtualHost name:port> without the NameVirtualHost name:port or you try to use the Listen directive, your configuration will not work.
参考Running different sites on different ports.
服务器配置
Listen 80
Listen 8080
NameVirtualHost 172.20.30.40:80
NameVirtualHost 172.20.30.40:8080
<VirtualHost 172.20.30.40:80>
ServerName www.example.com
DocumentRoot /www/domain-80
</VirtualHost>
<VirtualHost 172.20.30.40:8080>
ServerName www.example.com
DocumentRoot /www/domain-8080
</VirtualHost>