Setting Up VirtualHosts for a local RubyOnRails Application

Posted by chris Frisina on Server Fault See other posts from Server Fault or by chris Frisina
Published on 2012-12-18T01:03:09Z Indexed on 2012/12/18 5:04 UTC
Read the original article Hit count: 512

I want to set up a VirtualHost so that when I type the project name in the address bar, it goes to the home page of the project.

httpd-vhosts.conf files in both XAMPP configuration and apache configuration:

<VirtualHost project>
    ServerAdmin [email protected]
    ServerName project
    DocumentRoot /Users/path/to/project/public
    <Directory "/Users/path/to/project/public">
        Options Includes FollowSymLinks
        AllowOverride All
        Order deny,allow
        Allow from all
    </Directory>
    RewriteEngine On
    RewriteOptions inherit
</VirtualHost>

I have also tried with the path directly to the project folder, and not the public folder of the project.

the httpd.conf of XAMPP and apache :

# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

the /etc/hosts file:

127.0.0.1   other1

127.0.0.1   other2

127.0.0.1   project

I have tried :

127.0.0.1        project
127.0.0.1:3000   project
127.0.0.1        project:3000

I have also restarted the rails server and the XAMPP server many times after changes. I have it working so that the project:3000/ works, but how do I get it so that I dont have to specify the port number?

Notes:

  • All other VHosts are working well.
  • Rails 3.2.8 (willing to change)
  • Ruby 1.9.3
  • WEBrick server

© Server Fault or respective owner

Related posts about apache2

Related posts about virtualhost