Reputation: 407
I have main Rails app working on system Ruby and Passanger. Following virtual host works just fine:
<VirtualHost x.x.x.x:80>
ServerName domain.com
DocumentRoot /home/john/apps/main_app/public
PassengerRoot /var/lib/gems/1.9.1/gems/passenger-4.0.29
PassengerRuby /usr/bin/ruby
<Directory /home/deploy/apps/main_app/public>
PassengerEnabled On
AllowOverride All
Require all granted
Options -MultiViews
</Directory>
</VirtualHost>
Now I want to add second virtual host for my second app working on different Ruby/Passanger versions and different domain but on same machine:
<VirtualHost x.x.x.x:80>
ServerName domain2.com
DocumentRoot /home/deploy/apps/app/public
PassengerRoot /home/deploy/.rvm/gems/ruby-2.1.5@app/gems/passenger-4.0.59
PassengerRuby /home/deploy/.rvm/rubies/ruby-2.1.5/bin/ruby
<Directory /home/deploy/apps/app/public>
PassengerEnabled On
AllowOverride All
Require all granted
Options -MultiViews
</Directory>
</VirtualHost>
After enabling second VirtualHost the first one (main app) is not working anymore. In browser I have 403 error. Same situation for second app.
Error log from main application:
[Sun Feb 15 13:29:08.596451 2015] [autoindex:error] [pid 53380] [client x.x.x.x] AH01276: Cannot serve directory /home/john/apps/main_app/public:
No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm)
found, and server-generated directory index forbidden by Options directive, referer: x
After disabling second app first one is working. How can I make to work both apps in the same time?
Upvotes: 0
Views: 488
Reputation: 176472
The configurations are incorrect. The two virtual hosts are using two different Passenger versions, and loading two different Ruby versions.
<VirtualHost x.x.x.x:80>
PassengerRoot /var/lib/gems/1.9.1/gems/passenger-4.0.29
PassengerRuby /usr/bin/ruby
</VirtualHost>
vs
<VirtualHost x.x.x.x:80>
PassengerRoot /home/deploy/.rvm/gems/ruby-2.1.5@app/gems/passenger-4.0.59
PassengerRuby /home/deploy/.rvm/rubies/ruby-2.1.5/bin/ruby
</VirtualHost>
Upvotes: 1