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:
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.
I ran the following commands to install passenger:
sudo gem install passenger passenger-install-apache2-module
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
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>
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
?