Using mod_rails to host multiple apps under SSL, same domain - ruby-on-rails

I'm trying to get multiple rails apps hosted under the same domain, but different directories. My configuration before attempting to host multiple apps (which works great), looks like this:
<VirtualHost *:443>
ServerName secure.mydomain.com
DocumentRoot /root/store/public
</VirtualHost>
I google'd around and found documentation suggesting I use the following configuration:
<VirtualHost *:443>
ServerName secure.mydomain.com
DocumentRoot /root
RailsBaseURI /store/public
RailsBaseURI /store2/public
</VirtualHost>
That configuration, however, only causes my directory structure to be revealed, and no app appears to run. Any advice would be great!

Not sure what you found on the Googles, but you might want to re-read the mod_rails docs on Deploying to sub URIs
I'm guessing you'll need to create some symbolic links (aliases) in your /root directory to the public folder of each application
ln -s /store/public /root/store

Related

Remove Bitnami Jenkins Access page

I have bitnami jenkins installed.
I have no problem with the url http://yourhost/jenkins but i need to delete the Bitnami Welcome page. is any idea?
The documentation (https://wiki.bitnami.com/Components/Bitnami_info_page) says that the bnconfig tool should be used. However for me this doesn't work and I changed it manually in the apache configuration files.
To do so, change in file /opt/bitnami/apache2/conf/bitnami/bitnami.conf the lines:
<VirtualHost _default_:80>
DocumentRoot "/opt/bitnami/apache2/htdocs"
and
<VirtualHost _default_:443>
DocumentRoot "/opt/bitnami/apache2/htdocs"
into:
<VirtualHost _default_:80>
DocumentRoot "/opt/bitnami/apps/jenkins/htdocs"
and
<VirtualHost _default_:443>
DocumentRoot "/opt/bitnami/apps/jenkins/htdocs"
Then restart apache:
sudo /opt/bitnami/ctlscript.sh restart apache
This si brutal but it works, and the vhost (http://yourhost/jenkins should also work) :)
Note that the main documentation (https://wiki.bitnami.com/Native_Installers_Quick_Start_Guide) says in part "How to change the default page that appears when accessing the installation?" that changing it manually is the way to go, but suggest to use a modified version of the main page. I guess this is fine if you have several apps installed.

zend framework skeleton application not showing properly

I have installed the Skeleton Application manually. My application is kept in "D:\xampp\htdocs\zf2". I've created a virtual host in the following way, in httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName zf2
DocumentRoot "D:/xampp/htdocs/zf2/public/index.php"
<Directory "D:/xampp/htdocs/zf2/public/index.php">
#DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
but it does not shown properly and it gives the output
and the remain ing application with module and database shows also not shows in the proper way
but if i slightly modify in virtual host settings of
DocumentRoot "D:/xampp/htdocs/zf2/public/index.php"
to
DocumentRoot "D:/xampp/htdocs/zf2/public"
then, skeleton application shows fine but when i configure module and database it gives error "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. zend sleleton application error"
can any one help me i have waste lot of time to set it but didn't.
You need to set document root to the folder not a file. The page looks messed up when pointing to index.php as documentroot because it cannot find the stylesheets.
The issue with configuring the module/database is probably a different issue, and you would have to post your module/database configuration to get help there.

Rails 3 Deploy: Multiple rails apps single domain error: No such file or directory - config/environment.rb

Yesterday, I bought a server on Linode. I setup Apache, RVM, Rails, MySQL and have got a single rails app hosted on a domain, following a nice guide from http://library.linode.com/frameworks/ruby-on-rails-apache/ubuntu-10.04-lucid. It also explains how to put multiple rails apps on the same domain, however when I try, I get an error when I access my domain our-portal.com/adm :
No such file or directory - config/environment.rb
Application root: /srv/www/our-portal.com/public_html
Somethings wrong here... anyone have any ideas? I am able to host a single app just fine, but not multiple... Here is my Virtual Host settings
<VirtualHost *:80>
ServerAdmin webmaster#our-portal.com
ServerName our-portal.com
ServerAlias www.our-portal.com
DocumentRoot /srv/www/our-portal.com/public_html/
RailsBaseURI /adm
RailsBaseURI /matrix
ErrorLog /srv/www/our-portal.com/logs/error.log
CustomLog /srv/www/our-portal.com/logs/access.log combined
</VirtualHost>
My applications path is in /srv/www/our-portal.com/adm/ and I linked using
ln -s /srv/www/our-portal.com/adm/public/ /srv/www/our-portal.com/public_html/adm/
ln -s /srv/www/our-portal.com/matrix/public/ /srv/www/our-portal.com/public_html/matrix/
Try by setting the DocumentRoot to the public folder of your application:
DocumentRoot /srv/www/our-portal.org/app/public
I got it working, these are the changes I made.
<VirtualHost *:80>
ServerAdmin webmaster#our-portal.com
ServerName our-portal.com
ServerAlias www.our-portal.com
DocumentRoot /srv/www/our-portal.com/public_html
<Directory /srv/www/our-portal.com/public_html>
Allow from all
</Directory>
RailsBaseURI /adm
RailsBaseURI /matrix
<Directory /srv/www/our-portal.com/public_html/adm>
Options -MultiViews
</Directory>
<Directory /srv/www/our-portal.com/public_html/matrix>
Options -MultiViews
</Directory>
ErrorLog /srv/www/our-portal.com/logs/error.log
CustomLog /srv/www/our-portal.com/logs/access.log combined
</VirtualHost>
I also believe my links were not created correctly. It helped to type
ln -s
and double-click tab (without executing the command) to look at the correct way Unix handles the path for this function. My links looked like this
ln -s /srv/www/our-portal.com/adm/public/ our-portal.com/public_html/adm
ln -s /srv/www/our-portal.com/sitedb-pro/public/ our-portal.com/public_html/matrix
Notice the difference from my old links. Using double-click tab I was able to reference these folders correctly.

Passenger on Ubuntu still only serving default index.html

Trying to get my server to serve my rails apps.
I have a test app installed, apache2 and passenger have been installed have I have added the following to the apache2.conf
# Include the virtual host configurations:
Include sites-enabled/
NameVirtualHost localhost:80
<VirtualHost localhost:80>
ServerName 192.168.1.67
DocumentRoot /home/john/Public/test-app
</VirtualHost>
Clearly, I am misunstanding something, because I think that should redirect calls to my local IP to my rails app. It is not. It is going to the default apache index.html.
What am I doing wrong?
UPDATED answer:
I think you are missing the "Directory" node. try using this config code:
(assuming your project path is: /home/john/Public/test-app)
<VirtualHost *:80>
DocumentRoot /home/john/Public/test-app/public
RailsEnv development
<Directory /home/john/Public/test-app/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
This is how I usually do it:
<VirtualHost *:80>
ServerName mysubdomain.betamaster.us
DocumentRoot /var/www_home/mysubdomain/
</VirtualHost>
After applying these changes make sure to execute
/etc/init.d/apache2 reload
in order to reload the server configuration.
I had the same symptoms in this question but it was a different problem. My apache install already had a Virtual host enabled, so I had to disable it and enable my own with the commands
sudo a2dissite default
sudo a2ensite myapp
where default was the name of the Virtual Host file included by default in sites-avaliable/ and myapp is the file i added.
Hopefully this helps someone.

Rails app deployed with Passenger just displays index of app's public directory

I am trying to deploy a Rails application on Ubuntu 9.04 using Passenger.
As far as I can see, I have everything configured correctly; however when I point my browser at my domain, all I see is the index of the app's public directory.
My hunch is that Passenger is not starting up - at the bottom of just-plain-folks.co.uk there's no reference to Passenger at all. There's nothing interesting in the log files.
This is my config:
/etc/apache2/mods-enabled/passenger.conf
<IfModule passenger_module>
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.9
PassengerRuby /usr/bin/ruby1.8
</IfModule>
/etc/apache2/mods-enabled/passenger.load
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.9/ext/apache2/mod_passenger.so
/etc/apache2/sites-enabled/just-plain-folks.co.uk
<VirtualHost *:80>
ServerAdmin admin#just-plain-folks.co.uk
ServerName just-plain-folks.co.uk
ServerAlias www.just-plain-folks.co.uk
DocumentRoot /srv/www/just-plain-folks.co.uk/public_html/
ErrorLog /srv/www/just-plain-folks.co.uk/logs/error.log
CustomLog /srv/www/just-plain-folks.co.uk/logs/access.log combined
</VirtualHost>
/srv/www/just-plain-folks.co.uk/public_html/ is a simlink to the public directory of my application
If there's anything else that might be useful in diagnosing this, let me know. Any help is much appreciated!
Try ditching the symlink and pointing directly as public. I believe passenger is a little magic in this area as to how it detects the rails app.
Even if the symlink source was called public, I suspect it would still be looking for a rails_root in /srv/www/just-plain-folks.co.uk/.
(Updated: I missed the fact that you're trying to serve from the docroot)
Try turning off MultiViews
<VirtualHost *:80>
...
<Directory /srv/www/just-plain-folks.co.uk/public_html>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
Well, I had the similar issue with Sinatra, Phusion Passenger and Apache. My public directory was nested somewhere in deep, and the same thing with the views directory.
So, following configurations made my app running.
In apache's conf file, instead of /home/me/projects/fantasy-app/somewhere/nested/public, I just had to use /home/me/projects/fantasy-app/public in the DocumentRoot and <Directory> directives.
In my app.rb which onfig.ru refers to, I had the following:
set :public_folder, 'build/development/public'
set :views, Proc.new { File.join(root, "build/development/views") }

Resources