How can I get RVM/Passenger/Apache2 to play nicely together

So there are 2 other files that are in the sites-available directory.

  • default
  • default-ssl

I changed the name of the of the file called site to default in the
sites-available directory and restarted apache and that was still no
luck. I also moved the site application into /var/www and www-data the
owner /var/www/*. Changed the location of RootDocument in the site
file in sites-available and still no luck.

I am not sure how to make my .rvm directory readable to the rest of my
system without making my entire home directory readable to the entire
system. I assume that is not a good idea.

On Dec 15, 2:05pm, Frederick C. [email protected]

Brynjolfur,

Setting up a sym link seems to have done the trick. Pointing that to
my www directory in my home directory seems to have done the trick.

I have also set the www directory in my home directory to be read/
write by “other” as well.

Once I took my browser to http://llocalhost/site everything came up
fine.

I don’t recall changing any permissions to my .rvm directory in my
home directory.

So now that I know that that works, I will try this process all over
again to make sure I have the steps down right.

I would like to thank you all for being patient with me as I try to
get all of this working.

Vell, with your setup as far as I can see, you can without changing the
apache site and localhost files at all.

You can create a symbolic link from your /var/www directory to your
Rails directory, something along these lines:

$sudo ln -s /home/vmcilwain/www/site/public /var/www/site

Now, if you go to http://localhost/site you should get your Rails site
up.

Of course, it is different if you want to be able to get your site to
answer to http://localhost directly. One way I have achieved this is to
edit /etc/apache2/sites-available/default (only change is at top,
DocumentRoot, and removing the <directory /var/www> section which isn’t
really necessary):

<VirtualHost *:80>
ServerAdmin webmaster@localhost

    DocumentRoot /home/binni/mysite/public
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, 

crit,
# alert, emerg.
LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

-----Oprindelig meddelelse-----
Fra: [email protected]
[mailto:[email protected]] P vegne af Vell
Sendt: 15. december 2011 18:55
Til: Ruby on Rails: Talk
Emne: [Rails] Re: How can I get RVM/Passenger/Apache2 to play nicely
together

Mircea,

I tried this installation guide just now and I am still in the same
place. Though the instructions are clear, I am still not able to get to
my rails application that is located in my home directory. This is on a
fresh installed Ubuntu 11.10 system as well. So here is what has been
done, based on that guide:

RVM Steup
sudo aptitude install build-essential git-core curl

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/
rvm”’ >> ~/.bashrc

rvm notes

sudo aptitude install build-essential openssl libreadline6
libreadline6-dev zlib1g zlib1g-dev zlib libssl-dev libyaml-dev
libsqlite3-0 libsqlite3-dev sqlite3 libxml2- dev libxslt-dev autoconf
libc6-dev ncurses-dev automake libtool bison

rvm install 1.9.2

rvm use 1.9.2

rvm --default use 1.9.2

RAILS SETUP 1
gem install rails

Added the following to my Gemfile
gem ‘execjs’
gem ‘therubyracer’

bundle install

rails s (saw my application locally on port 3000)

APACHE2 Setup

sudo aptitude install apache2

Passenger Setup

gem install passenger

passenger-install-apache2-module

Added the following to /etc/apache2/apache2.conf LoadModule
passenger_module /home/user/.rvm/gems/ruby-1.9.2- p290/gems/
passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /home/user/.rvm/gems/ruby-1.9.2-p290/gems/
passenger-3.0.11
PassengerRuby /home/user/.rvm/wrappers/ruby-1.9.2-p290/

restarted apache2

Creating My Site

Created directory www in my home directory

rails new site -d mysql

Added the following to /etc/apache2/sites-available/site <VirtualHost
*:80> ServerName localhost ServerAlias localhost DocumentRoot
/home/vmcilwain/www/site/public

sudo a2ensite site

sudo a2enmod rewrite

sudo service apache2 reload

Attempted to hit the application with the browser (http://localhost) and
I get: It Works! (Apache standard page) Attempt to hit the application
with the location http://localhost/site and I get: Not Found The
requested URL /site was not found on this server

According to the guide, I should have seen the welcome aboard page of
the site application in my www directory.

I can’t be this hopeless, what else can I be doing wrong :-/ Any help
again is greatly appreciated.

On Dec 14, 3:10 am, mg1313 [email protected] wrote:

when I attempt to locally point my browser to a basic rails
application.

I am attempting to set this up on an Ubuntu 11.10 system.

Any help would be greatly appreciated.

Thanks in advance.


You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Hmm one more question before I call this a complete success, I just
tried to create a new scaffold but it looks like I continue to get the
welcome board page of my app. Is this because my sym link is only
pointing at public?

I removed the index.html file from the application and created a model
called “me”:

bundle exec rails generate scaffold me email:string
bundle exec rake:migrate

when I then try to go to http://localhost/mes I get the requested URL /
site/mes was not found.

Nevermind, my sym link was pointing to an old directory that had the
same application name which was the test to see if it was working
using localhost 3000. So at this point When I set up the sym link
correctly and I hit the location with a browser, I am getting a list
of the contents of public. Maybe that is the intended behavior until I
recreate my basic scaffold.

Go to http://localhost/site/me (assuming that Rails previously answered
to http://localhost/site and the model is called “me” and not “mes”

Alternatively you could edit the config/routes.rb file and tell it to
point root to the “me” folder. The command is somewhat different
depending on your version of Rails but in my current 3.10 the line would
look like this:

root :to => ‘me#index’

-----Oprindelig meddelelse-----
Fra: [email protected]
[mailto:[email protected]] P vegne af Vell
Sendt: 15. december 2011 21:39
Til: Ruby on Rails: Talk
Emne: [Rails] Re: How can I get RVM/Passenger/Apache2 to play nicely
together

Hmm one more question before I call this a complete success, I just
tried to create a new scaffold but it looks like I continue to get the
welcome board page of my app. Is this because my sym link is only
pointing at public?

I removed the index.html file from the application and created a model
called “me”:

bundle exec rails generate scaffold me email:string bundle exec
rake:migrate

when I then try to go to http://localhost/mes I get the requested URL /
site/mes was not found.

On Dec 15, 2:37 pm, Brynjolfur T. [email protected] wrote:

<VirtualHost *:80>
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

I tried this installation guide just now and I am still in the same place.
Though the instructions are clear, I am still not able to get to my rails
application that is located in my home directory. This is on a fresh installed
Ubuntu 11.10 system as well. So here is what has been done, based on that guide:

Added the following to /etc/apache2/apache2.conf LoadModule
Created directory www in my home directory

Try the documentation from
here:http://www.mirceagoia.com/2011/11/ruby-on-rails-installation-ubuntu-l

would post here to see if anyone has managed to get this to work
Thanks in advance.


You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.


You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Sorry to confuse you - this has something to do with Adhearsion which I
am installing along with Rails. The original symlink should probably
work fine, and I think it’s time I withdrew …

-----Oprindelig meddelelse-----
Fra: [email protected]
[mailto:[email protected]] P vegne af Brynjolfur
Thorvardsson
Sendt: 15. december 2011 21:55
Til: [email protected]
Emne: SV: [Rails] Re: How can I get RVM/Passenger/Apache2 to play nicely
together

Hi, I forgot one thing that you might need to do. When using a symlink I
think you need to add some lines to the bottom of the apache config
file. Here is what I did in a previous setup which works:

$sudo ln -s /home/binni/rails/testapp/public /var/www/public

$sudo vim /etc/apache2/sites-available/default
Added lines:
RailsBaseURI /testapp
RailsEnv development
$sudo service apache2 restart

The symlink is slightly different from the one I sent you earlier, it
creates a “public” link in the end of the command.

-----Oprindelig meddelelse-----
Fra: [email protected]
[mailto:[email protected]] P vegne af Vell
Sendt: 15. december 2011 21:48
Til: Ruby on Rails: Talk
Emne: [Rails] Re: How can I get RVM/Passenger/Apache2 to play nicely
together

Nevermind, my sym link was pointing to an old directory that had the
same application name which was the test to see if it was working using
localhost 3000. So at this point When I set up the sym link correctly
and I hit the location with a browser, I am getting a list of the
contents of public. Maybe that is the intended behavior until I recreate
my basic scaffold.

On Dec 15, 3:38 pm, Vell [email protected] wrote:

<VirtualHost *:80>
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

I tried this installation guide just now and I am still in the same place.
Though the instructions are clear, I am still not able to get to my rails
application that is located in my home directory. This is on a fresh installed
Ubuntu 11.10 system as well. So here is what has been done, based on that guide:

Added the following to /etc/apache2/apache2.conf LoadModule
Created directory www in my home directory

Can anyone point me to any solid documentation on how to set up

Any help would be greatly appreciated.

Thanks in advance.


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.


You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Hi, I forgot one thing that you might need to do. When using a symlink I
think you need to add some lines to the bottom of the apache config
file. Here is what I did in a previous setup which works:

$sudo ln -s /home/binni/rails/testapp/public /var/www/public

$sudo vim /etc/apache2/sites-available/default
Added lines:
RailsBaseURI /testapp
RailsEnv development
$sudo service apache2 restart

The symlink is slightly different from the one I sent you earlier, it
creates a “public” link in the end of the command.

-----Oprindelig meddelelse-----
Fra: [email protected]
[mailto:[email protected]] P vegne af Vell
Sendt: 15. december 2011 21:48
Til: Ruby on Rails: Talk
Emne: [Rails] Re: How can I get RVM/Passenger/Apache2 to play nicely
together

Nevermind, my sym link was pointing to an old directory that had the
same application name which was the test to see if it was working using
localhost 3000. So at this point When I set up the sym link correctly
and I hit the location with a browser, I am getting a list of the
contents of public. Maybe that is the intended behavior until I recreate
my basic scaffold.

On Dec 15, 3:38 pm, Vell [email protected] wrote:

<VirtualHost *:80>
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

I tried this installation guide just now and I am still in the same place.
Though the instructions are clear, I am still not able to get to my rails
application that is located in my home directory. This is on a fresh installed
Ubuntu 11.10 system as well. So here is what has been done, based on that guide:

Added the following to /etc/apache2/apache2.conf LoadModule
Created directory www in my home directory

Can anyone point me to any solid documentation on how to set up

Any help would be greatly appreciated.

Thanks in advance.


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.


You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

So much for thinking things were working. Nothing I have tried has
worked. Thanks for the suggestions all but at this point, Im
frustrated enough that I am going to take a break for a while before I
throw this machine out the window and drop rails entirely.

It shouldn’t be this hard to get a production server setup.

Adding those lines to the site I at least am getting a passenger error
which is better than not getting anything at all. That is finally
progress.

Thank you for the additional info. I have also put everything into the
apache2 file instead of splitting them into different files. Once I
step away for a while and come back to it to try and get the rest
working I will split the files as Apache would want me to.

Would I be able to switch the RailsEnv when I am finally ready to put
this into production mode?

OK, So through all the pain an anguish I think I finally have a
working server (NO JOKE!)

Here are the steps that I have done to get this working with apache,
passenger, and rvm

After installing all the necessary software
software update
rvm (single user)
rails
passenger
passenger apache module

I did the following:
Created directory apps in my home directory
Created a rails app called site in the newly created apps directory
Added the following to the apache2.conf file

<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www
RailsBaseURI /site
RailsEnv development

LoadModule passenger_module /home/vmcilwain/.rvm/gems/ruby-1.9.2-p290/
gems/passenger-3.0.11/ext/apache2/mod_passenger.so

PassengerRoot /home/vmcilwain/.rvm/gems/ruby-1.9.2-p290/gems/
passenger-3.0.11
PassengerRuby /home/vmcilwain/.rvm/wrappers/ruby-1.9.2-p290/ruby

Then created a symlink called sites that points to /home/vmcilwain/
apps/site/public

From there, I can hit http://localhost/site and get the index page of
the sites app. When I click on the link for looking at the application
environement the information comes up which tells me that my
application is working as it should be.

Thanks everyone for being patient with me and my frustration.