Does Nginx with Passenger actually work?

Marnen Laibow-Koser wrote:

Pål Bergström wrote:

And what errors are you getting?

The browser can't find the server.

Anyway, unless you are using your Mac as a server, why are you running Passenger on it in the first place? Mongrel is perfectly suitable for development.

Well why not?

1) To learn Nginx before deployment on a VPS with Debian 5. 2) Easier and more convenient than keeping separate servers running under mongrel (I currently use Lightspeed).

I haven't used that tutorial, but I know that I had no trouble getting Nginx and Passenger working together on Ubuntu.

Hmm. Good to know. Probably the same on Debain. Did you install it via Passenger or apt?

When I tried installing it on OSX, I came to the conclusion that things were not working due to permissions on the Mac – if I remember right, between Passenger and the folder in which my app sits, as I was probably running Passenger under sudo. I gave up as I was really aiming to get things working on Ubuntu. The Ubuntu install went flawlessly without changing permissions.

Sounds to me apache isn’t running or your vhosts don’t resolve. When Passenger fails, you get a Passenger error screen describing the error, it never results in server not found.

Solution for apache:

System Prefs > Sharing > Web Sharing : enable

Solution for vhosts not resolving:

Best solution: Run a local dns server and add the domains:

Alternative: edit /etc/hosts and add the domains you intend to use

Best regards

Peter De Berdt

Woops, instead of Apache not running, it seems nginx isn’t running properly.

Check it with:

ps ax | grep nginx

This can be because Apache is up and running, make sure it’s disabled in the system preferences.

Best regards

Peter De Berdt

Peter De Berdt wrote:

Peter De Berdt wrote:

So what did you do then? Point the top root of the nginx server to your Rails’ public folder?

Because as soon as you fill in server_name in your configuration, you need to have a host resolve to your server in order for Passenger to serve the page.

    server {
listen 80;
**server_name [](**        ;
root /webapps/mycook/public;
passenger_enabled on;

As has been suggested, things could well be screwed up because of permissionst too.

Best regards

Peter De Berdt

Peter De Berdt wrote:

Good to hear :slight_smile:

You should be able to run nginx on OS X on port 80 too btw. Just make sure you run it as a sudo user (or as root). You’re best off running nginx as a LaunchDaemon and adding some domains to /etc/hosts (or set up a local dns server, which would be even better), so you can run multiple rails app under the same nginx instance without having to stop the server, change the root, start the server etc.

Best regards

Peter De Berdt

Peter De Berdt wrote:

or set up a local dns server, which would be even better

Not sure how. Any suggestions? I've heard of BIND but not sure that's valid for Mac OS 10.6. But sooner or later I have to get a better grip of DNS and DNS servers.

The ghost gem achieves the same result as editing /etc/hosts and is much more convenient.

Cheers, Walter