[Mono-aspnet-list] Mono + Nginx + Open BSD

Gee g.plumb at gmail.com
Wed May 15 18:23:52 UTC 2013


Hi all

It turns out that OpenBSD chroots nginx - so my path /tmp/xxx is outside of
the jail (which is why the socket is not found).  The solution was easy
enough - point to a path inside the jail - which for reference is:

/var/www/<blah>

Thanks to everyone who posted suggestions!  :-)


Thanks
G



On 8 May 2013 23:26, Jesse Pasichnyk <jesse at pasichnyk.net> wrote:

>  Hrm, in addition to the sockets I have a folder “www-data-temp-aspnet-0”
> in /tmp, as well as some other random named folders (e.g., 7fff3bc1).  All
> my files are owned as www-data:, which is what my fastcgi runs as.****
>
> ** **
>
> Not sure if that helps, but I’m on Linux as well, so not sure what else
> might be the issue.****
>
> ** **
>
> -****
>
> Jesse****
>
> ** **
>
> *From:* Gee [mailto:g.plumb at gmail.com]
> *Sent:* Wednesday, May 08, 2013 1:12 PM
> *To:* Jesse Pasichnyk
> *Cc:* Daniel Lo Nigro; mono-aspnet-list at lists.ximian.com
>
> *Subject:* Re: [Mono-aspnet-list] Mono + Nginx + Open BSD****
>
> ** **
>
> Hi Jesse****
>
> Thanks for getting back to me so quickly  :-)****
>
> Sadly, /tmp is also owned by root and its permissions (and its children)
> match the socket's  :-(****
>
> ** **
>
> On 8 May 2013 21:02, Jesse Pasichnyk <jesse at pasichnyk.net> wrote:****
>
>   Check your actual /tmp folder permissions.  I believe some other folder
> gets creates there that requires write access as well.
>
> Sent from my Windows Phone****
>   ------------------------------
>
> *From: *Gee <g.plumb at gmail.com>
> *Sent: *5/8/2013 12:49 PM
> *To: *Daniel Lo Nigro <lists at dan.cx>
> *Cc: *mono-aspnet-list at lists.ximian.com
> *Subject: *Re: [Mono-aspnet-list] Mono + Nginx + Open BSD****
>
> Hi all
>
> So this is what I did...
>
>
> For sanity's sake:
> chown root /tmp/fastcgi-mono-socket
> chmod 777 /tmp/fastcgi-mono-socket
>
>
> To see permissions on the socket
> ls -la /tmp/fastcgi-mono-socket:
>
> Output:
> srwxrwxrwx  1  root  wheel  0 May  8 16:01 fastcgi-mono-socket
>
> grep wheel /etc/group
>
>
> To see contents of group 'wheel':
> cat /etc/group | grep --regex "^xxx:.*" | awk -F: '{print $4}'
>
> Output:
> root
>
> ****
>
> So I really have no idea what else I can do at this point.****
>
> Do anyone have any ideas?
>
> Thanks!
> G****
>
> ** **
>
> On 8 May 2013 14:50, Daniel Lo Nigro <lists at dan.cx> wrote:****
>
>  Hmm... I would have expected a "Permission denied" rather than a "No
> such file or directory" if it was a permissions issue. Maybe BSD handles
> this differently to Linux though.****
>
> ** **
>
> On Wed, May 8, 2013 at 5:11 PM, Ovidiu D <ovidiudeac at gmail.com> wrote:****
>
>  I'm not a BSD user so I don't know for sure but apparently the unix
> sockets permissions behave differently compared to Linux . See this:
> http://stackoverflow.com/questions/5977556/how-can-i-change-the-permissions-of-a-linux-socket-file
> ****
>
> ** **
>
> Anyway, having both the client and the server of the socket running with
> the same user should help here.****
>
> ** **
>
> ** **
>
> ** **
>
> On Wed, May 8, 2013 at 9:58 AM, Ovidiu D <ovidiudeac at gmail.com> wrote:****
>
>  Looking again at our upstart scripts I see that we start the fastcgi
> server using the same user as nginx. Can you do that?****
>
> ** **
>
> If it doesn't work can you post the whole startup script for your fastcgi
> server?****
>
> ** **
>
> On Wed, May 8, 2013 at 1:58 AM, Gee <g.plumb at gmail.com> wrote:****
>
>    Hi Ovidiu****
>
> I tried TCP earlier to little avail.****
>
> *However*****
>
> ** **
>
> I tried it again anyway (just to say that I did it again) and I got a
> YSOD/Exception (which is a start!).  After tweaking Web.config and
> restarting nginx - my hello world actually printed 'hello world'.  It's
> almost sad how much joy this brought me!  :-)****
>
> Now I know TCP does actually work (although I am not sure why it does
> now), I can set about solving why the unix socket is behaving so
> strangely.  I suspect that you (and the others earlier in this thread) are
> indeed all correct about the permissions issue.****
>
> ** **
>
> I have set about resolving it, but I can't see to get past it.****
>
> ** **
>
> I have chmod '777' (for now) - to no avail.****
>
> I ran chmod a+rwx as well - to no avail.****
>
> I even tried a different path - sadly, to no avail!****
>
> ** **
>
> I am sure I am missing something obvious, although I have no idea what it
> could be... :-(****
>
> ** **
>
> Any advice would be hugely appreciated!****
>
> ** **
>
> ** **
>
> Thanks****
>
> G****
>
> ** **
>
> On 7 May 2013 20:57, Ovidiu D <ovidiudeac at gmail.com> wrote:****
>
>  I'm pretty sure that you have a permission problem here. You should
> double check that both the users of the nginx and mono fastcgi server
> processes have rw access to that socket.****
>
> For debugging purposes you can also try to use a TCP socket instead of a
> unix socket and once your setup works you can move back to unix sockets.**
> **
>
> ** **
>
> On Tue, May 7, 2013 at 9:56 PM, Gee <g.plumb at gmail.com> wrote:****
>
>   Hi ****
>
> ** **
>
> I am having trouble getting Mono to work with nginx.  I installed my OS
> (OpenBSD 5.3) and set up 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 a *very* simple MVC3 app - it is literally a hello
> world controller (no fancy code whatsoever) - but I keep getting a 502 (Bad
> gateway).  In the log, 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 here is that /tmp/fastcgi.socket does actually
> exist.  I tried 'touch' and making sure 'www' and 'wheel' have the
> appropriate permissions (which they do).  The result of 'ls -la
> /tmp/fastcgi.socket' revealed nothing awry.  I tried using a different path
> (such as '/home/socket' and '/home/fastcgi.socket'), but all to no avail.*
> ***
>
> ** **
>
> Does anyone have any ideas/hints?  Could this be a bug in the port?****
>
> ** **
>
> To try and save time, 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 /Home/Index;****
>
> ** **
>
>             fastcgi_pass   unix:/tmp/fastcgi.socket;****
>
>             # include        fastcgi_params;****
>
>             include /etc/nginx/fastcgi_params;****
>
>         }****
>
>     }****
>
> }****
>
> ** **
>
> ** **
>
> ** **
>
> Thanks!****
>
> G****
>
> ** **
>
> _______________________________________________
> Mono-aspnet-list mailing list
> Mono-aspnet-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-aspnet-list****
>
>  ** **
>
>  ** **
>
>  ** **
>
>  ** **
>
>
> _______________________________________________
> Mono-aspnet-list mailing list
> Mono-aspnet-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-aspnet-list****
>
>  ** **
>
>  ** **
>
>  ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20130515/15ecfa2f/attachment-0001.html>


More information about the Mono-aspnet-list mailing list