我已经在本地网络上搭建了一个Ubuntu服务器,并安装了Apache2。
我想要在同一台服务器上管理不同的应用程序,当您请求一个url时,会提供专门的应用程序。
例如:
http://192.168.0.25/my_app_1 -> responds with app1 (for example a Ruby on Rails app)
http://192.168.0.25/my_app_2 -> responds with app2 (for example a php website)
[...]
# where 192.168.0.25 is the IP of the server
我认为这可以通过正确配置Apache2中的虚拟主机来完成。
目前,app1(即Ruby on Rails)的示例配置如下:
<VirtualHost 192.168.0.25:80>
DocumentRoot path_to_my_public_app1_folder
<Directory path_to_my_public_app1_folder>
Options -MultiViews
AllowOverride All
</Directory>
RailsEnv production
</VirtualHost>
如何定义子路径?可能是这样的吗?
<VirtualHost 192.168.0.25/my_app1:80>
我这么做对吗? 因为此时此刻我收到了一个404错误(甚至没有自定义Apache页面“It's work!”)