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?
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>
Related
I have installed mod_passenger (passenger-install-apache2-module) and have the following in my Apache configuration:
LoadModule passenger_module /var/www/html/vendor/bundle/ruby/2.2.0/gems/passenger-5.0.24/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /var/www/html/vendor/bundle/ruby/2.2.0/gems/passenger-5.0.24
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.2.2/ruby
</IfModule>
RackEnv production
<VirtualHost *:80>
ServerName domain.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/html/public
<Directory /var/www/html/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
My Rails website is working however some URLs that end in .php or .txt do not get processed by Passenger resulting in a generic 404 page instead of the nicely formatted 404 page on my Rails site.
How can I route all file extensions to Passenger/Rails?
Or how can I make URLs that end in .php actually be processed by PHP.
I am deploying a ruby-on-rails application.
I have configured apache and passenger and the http server is listening on port 80.
When I try to access the home page using the browser, I simply get a list of files and directories instead of the home page.
Following are snippets from the apache config.
/etc/apache2/apache2.conf
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
/etc/apache2/httpd.conf
LoadModule passenger_module /home/user1/.rvm/gems/ruby-2.3.0/gems/passenger-5.0.27/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/user1/.rvm/gems/ruby-2.3.0/gems/passenger-5.0.27
PassengerDefaultRuby /home/user1/.rvm/gems/ruby-2.3.0/wrappers/ruby
</IfModule>
/etc/apache2/sites-available/ubuntuvm-4.conf
<VirtualHost *:80>
ServerAdmin admin#ubuntuvm-4.com
ServerName ubuntuvm-4
ServerAlias www.ubuntuvm-4.com
DocumentRoot /home/user1/www/myapp/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
What is going wrong?
Could it be that I am trying to access the page via the ip address
http://192.168.0.12?
If you want me to put any other config, please shout.
try to copy the content of the file /etc/apache2/sites-available/ubuntuvm-4.conf
to /etc/apache2/sites-enabled/ubuntuvm-4.conf
cp /etc/apache2/sites-available/ubuntuvm-4.conf /etc/apache2/sites-enabled/ubuntuvm-4.conf
You need to create your config like this
<VirtualHost *:80>
ServerName ubuntuvm-4
<Location /home/user1/www/myapp/public>
PassengerBaseURI /
PassengerAppRoot /home/user1/www/myapp
</Location>
DocumentRoot /home/user1/www/myapp/public
<Directory /home/user1/www/myapp/public>
AllowOverride all
RailsEnv production
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
</VirtualHost>
I had the same problem trying to deploy a 4.2.1 Rails app on Ubuntu 12.04 using Ruby 2.3.2 (RVM because .deb packaged version is damn too old !!) Apache 2.2 and Passenger 5.0.4 (.deb).
Well, after wasting days to try to figure out why passenger wouldn't start (I did this a thousand times, it always worked), I realized it was only because Passenger couldn't print its logs anywhere. So, if you already tried everything you read on forums, just try to add a path to a log file in your apache configuration :
PassengerLogFile /var/log/passenger.log
and it worked like magic. Hope this helps.
I've been struggling with this for hours. It's the first time that I try to establish a server.
I have rails, passenger and apache installed.
In the httpd.conf here is what I wrote:
ServerRoot "/etc/httpd"
# Here I wrote the IP address, since I still did not manage the DNS
Listen ##.##.##.94:80
ServerAdmin root#localhost
ServerName ##.##.##.94:80 # Do I need this?
<Directory />
AllowOverride none
Require all denied
Options Indexes FollowSymLinks Includes ExecCGI
</Directory>
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.59
PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p551/wrappers/ruby
</IfModule>
<VirtualHost *:80>
ServerName ##.##.##.##
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/blah_blah/public_html/public
<Directory /var/www/blah_blah/public_html>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
</VirtualHost>
The last section was produced by passenger (I did not! copy it from the instructions :-) ).
When I go to the IP address I get an error that the page was not found.
I have rails running with "rails s". Before that I reloaded the server and restarted it for the config file to take effect.
Also, I granted apache user permission to the www folder.
What is the problem?
I even tried to put an index.html file in the public folder of rail and tried to go there, but failed.
BTW - when I do it from the console:
wget http://0.0.0.0:3000
I get a 200 response which means that it is OK.
Where is the fault?
I think you should change the port:
<VirtualHost *:3000>
Because when you run rails s it run on port 3000.
My requirement is to access http://myhost/ for my ROR project and access phpmyadmin and bugzilla using http://myhost/phpmyadmin/ and http://myhost/bugzilla/.
I wonder how to configure my VirtualHost and DocumentRoot, thanks for your comments!
Content of my /etc/httpd/conf/httpd.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.14/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.14
PassengerRuby /usr/bin/ruby
.....
.....
<VirtualHost *:80>
ServerName myhost
DocumentRoot /var/www/html/myProject/public
RailsEnv development
<Directory /var/www/html/myProject/public>
AllowOverride All
Options -MultiViews
</Directory>
</VirtualHost>
After digging the Passenger documents, I find there is a simple way to do so
<VirtualHost *:80>
ServerName myhost
DocumentRoot /var/www/html/myProject/public
RailsEnv development
<Directory /var/www/html/myProject/public>
AllowOverride All
Options -MultiViews
</Directory>
Alias /blog /var/www/html/phpmyadmin
<Location /phpmyadmin>
PassengerEnabled off
</Location>
</VirtualHost>
This will enforce Passenger to skip request under path /phpmyadmin
The easiest way, and with least amount of headaches would to just create subdomains for phpmyadmin and bugzilla. Then, just create a new virutalhost for each subdomain.
But, if your setup is necessary this seems like I possible solution.
http://macdiggs.com/2007/06/29/using-php-inside-rails-structure-on-apache/
I'm trying to add the Rails application to the a directory of another application and for some reason the rails application is not rendering
Here's a link to my application
Here's VHOST
<VirtualHost 184.106.111.142:80>
ServerAdmin joe#joe.com
ServerName transprintusa.com/design
# ServerAlias
DocumentRoot /srv/www/www.transprintusa.com/design/design.transprintusa.com/current/public
ErrorLog /srv/www/design.transprintusa.com/logs/error.log
RailsEnv production
<Directory "/srv/www/www.transprintusa.com/design/design.transprintusa.com/current/public">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
but the Rails application is showing all the files.
Passenger and everything is installed on this server because the Rails site was at design.transprintusa.com. Any ideas on what I'm doing wrong?
If there is anything I can give to help anyone help me
UPDATE - Here is my new VHOST and still displays the rails files
<VirtualHost 184.106.111.142:80>
ServerAdmin jom#jom.com
ServerName transprintusa.com
ServerAlias www.transprintusa.com
DocumentRoot /srv/www/www.transprintusa.com/
ErrorLog /srv/www/www.transprintusa.com/logs/error.log
CustomLog /srv/www/www.transprintusa.com/logs/access.log combined
<Directory "/srv/www/www.transprintusa.com/">
AllowOverride all
Options -MultiViews
</Directory>
RailsBaseURI /rails
<Directory /srv/www/www.transprintusa.com/design>
Options -MultiViews
</Directory>
</VirtualHost>
It doesn't work in this way. The ServerName must be a hostname.
You must set ServerName transprintusa.com, then use the Location or Directory directive to enable passenger when the request matches given location.
See Deploying to a sub URI from the Passenger documentation.