Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a number of Rails Apps working just great under Snow Leopard, but would like to migrate these to Lion.

However, like many others, the rug has been pulled from under my feet by the changes that have been made to Mac OS X Server admin with Lion.

That said, it has been straight-forward to install Rails and get my Rails app responding via the WEBrick web server.

I'd now like to get Passenger (or equivalent) working and use Apache as the web server, with automagically launched rails apps, and associated goodness.

However, the changes made to Lion appear to break Passenger, as this relies on named virtual hosts to detect invocations, and kick off the Rails Apps under Apache. I've tried using the method described in Apple's support note advice for Apache named hosts, - but I've had no joy :-/

It seems that I may need to bite the bullet and use the new Lion Server web app config mechanism to specify Rails dependencies, and launch the Rails Apps that way.

Has anyone had any success with configuring Lion Server to serve Rails Apps via Apache?

Any pointers and tips would be appreciated.

btw, I'm using a new Mac mini, so this is a clean install of Lion, and going back to SL isn't an option :-/

share|improve this question

migrated from serverfault.com Aug 7 '11 at 14:03

This question came from our site for system and network administrators.

1 Answer 1

up vote 1 down vote accepted

I've done some experimentation in order to answer my own question...

Firstly, I've only gotten the virtual named host kludge working with Passenger, not the new Lion scheme, but hey, it's a start...

Firstly, follow the Apple temporary fix, as linked in the question.

Then, the following works for me to support two virtual named hosts, implemented using Passenger and Rails. I derived this by taking the Lion virtual host example, and merging in my Snow Leopard config.

Disclaimer this works, but needs improvement. I've not got SSL working yet.

Add the following in a file named 0000_any_80_.conf

## Example Virtual Host Configuration

<VirtualHost *:80>
    ServerName bongle.example.com
    ServerAlias bungle.example.com
    ServerAdmin bongle@example.com
    RackEnv bongle_production
    RailsEnv bongle_production

    DocumentRoot "/Users/Nigel/Rails/bungle/public"
    CustomLog "/var/log/apache2/access_log" combinedvhost
    ErrorLog "/var/log/apache2/error_log"

    <IfModule mod_ssl.c>
        SSLEngine Off
        SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"
        SSLProtocol -ALL +SSLv3 +TLSv1
        SSLProxyEngine On
        SSLProxyProtocol -ALL +SSLv3 +TLSv1
    </IfModule>

    <Directory "/Users/Nigel/Rails/bungle/public">
        Options All +MultiViews -ExecCGI -Indexes
        AllowOverride None
        <IfModule mod_dav.c>
            DAV Off
        </IfModule>
    </Directory>

</VirtualHost> 

<VirtualHost *:80>
    ServerName burble.anothersite.com
    ServerAlias www.anothersite.com
    ServerAdmin bongle@anothersite.com
    RackEnv burble_production
    RailsEnv burble_production

    DocumentRoot "/Users/Nigel/Rails/burble/public"
    CustomLog "/var/log/apache2/access_log" combinedvhost
    ErrorLog "/var/log/apache2/error_log"

    <IfModule mod_ssl.c>
        SSLEngine Off
        SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"
        SSLProtocol -ALL +SSLv3 +TLSv1
        SSLProxyEngine On
        SSLProxyProtocol -ALL +SSLv3 +TLSv1
    </IfModule>

    <Directory "/Users/Nigel/Rails/school/public">
        Options All +MultiViews -ExecCGI -Indexes
        AllowOverride None
        <IfModule mod_dav.c>
            DAV Off
        </IfModule>
    </Directory>

</VirtualHost>

Additional contributions to improve this are welcome.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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