Search code examples
nginxmonoopenbsdxsp

502 (Bad Gateway) - Nginx + Mono (OpenBSD 5.3)


I am having trouble getting Mono to work with nginx. I installed OpenBSD 5.3 and set up the appropriate (package) ports. I built mono, mono-xsp and nginx - all without incident. All three appear to be working OK, but not in conjunction.

I am trying to run the default VS MVC3 template web app, but keep getting a 502 (Bad gateway). In the error logs, I see the following:

[crit] 31764#0: *1 connect() to unix:/tmp/fastcgi.socket failed (2: No such file or directory) while connecting to upstream,*

The frustrating thing is that /tmp/fastcgi.socket does exist. I tried 'touch' and making sure 'wheel' and 'www' has the appropriate permissions (chmod 775 and 777). The result of 'ls -la /tmp/fastcgi.socket' revealed nothing awry.

Here is my config:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    server {
        listen 80;
        access_log   /home/www/nginx.log;
        error_log    /home/www/errors.log;

        # root /home/www/test;
        # index index.html index.htm index.aspx default.aspx;

        location ^~ /Scripts/ { }
        location ^~ /Content/ { }

        location / {
            root /home/www/test;
            # fastcgi_index /;

            fastcgi_pass   unix:/tmp/fastcgi.socket;

            # include        fastcgi_params;
            include /etc/nginx/fastcgi_params;
        }
    }
}

Solution

  • I'm gonna hazard a guess that OpenBSD ports runs nginx jailed or chrooted. So check that first and if so you'll need to change the socket path to be created inside the jailed root.