I'm an iOS developer, so I have very little experience with Apache and RoR, and it's the first time I'm trying to use Mac OS X as server.

http://rubyonrails.org/deploy recommends using Phusion Passenger (mod_rails) with Apache. So that's what I'm trying to accomplish, but I've hit a dead end.

This is what I've done:

  1. I've enabled Apache (check box in settings) and pointing my browser to localhost gives me the text "It works!". I can also access it through my dyndns.

  2. I ran the following commands to install passenger:

    sudo gem install passenger
    passenger-install-apache2-module
    
  3. I added the following lines to /etc/apache2/httpd.conf:

    LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
    PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.7
    PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
    
  4. Then I added the following to /etc/apache2/extra/httpd-vhosts.conf:

    <VirtualHost *:80>
       ServerName my.dyndns.org
       DocumentRoot /Users/Shared/rails/project/public    # <-- be sure to point to 'public'!
       <Directory /Users/Shared/rails/project/public>
          AllowOverride all              # <-- relax Apache security settings
          Options -MultiViews            # <-- MultiViews must be turned off
       </Directory>
    </VirtualHost>
    
  5. I restarted Apache using:

    sudo /usr/sbin/apachectl restart
    

I have a working rails application at /Users/Shared/rails/project, i.e., running rails server works. It's just the "Welcome aboard, You’re riding Ruby on Rails!" page, but it works.

The problem is that I haven't figured out how to access that page through Apache and Passenger. I don't know how to configure a virtual host and I barely know what it is. Can anyone explain to me what I'm doing wrong and how to fix it?

EDIT: Just to be clear. I want my.dyndns.com/project to be publicly available on the Internet. What I'm getting now is "The requested URL /project was not found on this server."

EDIT 2: It seems like there aren't any virtual hosts:

$ sudo /usr/sbin/apachectl -S
VirtualHost configuration:
Syntax OK

Is there anything else that needs to be done besides adding the virtual host in /etc/apache2/extra/httpd-vhosts.conf?

link|improve this question
feedback

1 Answer

https://github.com/Fingertips/passengerpane

I would try downloading the Passenger Preference Pane and using that to set up your development environment. Otherwise, if you are really adventurous, try out http://pow.cx. I use Pow myself for my Rails development.

If you do go with Pow, I recommend the powder gem along with it for managing your Pow installation. It should be as simple as:

gem install powder

That should be all you need to do and then read up on powder here: https://github.com/Rodreegez/powder

link|improve this answer
This will only work locally, right? I mean if I try to access project.dev on another computer it will not work. I want my.dyndns.org/project to be publicly accessible. – Erik B Jul 5 '11 at 15:43
Pow is only for your machine. To publicly share you will need to point a domain name to your machine (probably through dyndns I am expecting) and then also update the ServerName in your config to represent that change (changing it to your domain name). – Bob Martens Jul 5 '11 at 16:06
It seems like that's what I've done. With the above configuration shouldn't my.dyndns.com run my rails app and not show Apache's "It works!"? – Erik B Jul 5 '11 at 16:25
It will if you have Apache set up to point to the folder and Passenger set up properly to have Rails requests sent to Passenger. – Bob Martens Aug 12 '11 at 20:23
I got it working and I probably should post the solution, but I'm having trouble finding the time. – Erik B Aug 15 '11 at 12:29
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.