5
我在本地網絡上安裝了一個帶有Apache2的Ubuntu服務器。Apache虛擬主機:不同的路徑爲同一IP上的不同應用程序提供服務
我想在同一個服務器上管理不同的應用程序,當你請求一個url時,一個專門的應用程序被提供。
E.g.
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(甚至沒有自定義阿帕奇頁「它的工作!」)
+1謝謝你爲完整的答案,現在它的作品! :) – damoiser