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>

</VirtualHost>


-----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 </VirtualHost>

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:
> Try the documentation from 
> here:http://www.mirceagoia.com/2011/11/ruby-on-rails-installation-ubuntu-l...
>
> Mircea
>
> On Dec 13, 10:52 pm, Vell <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hello all,
>
> > Can anyone point me to any solid documentation on how to set up a
> > production server using RVM, Passenger, and Apache2?  I have been at
> > this for a week with absolutely no luck at all so I thought I would
> > post here to see if anyone has managed to get this to work and
> > written down the steps they used.
>
> > Right now with my current implementation, I am getting a 404 error
> > 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.



-- 
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.

Reply via email to