Question

I have a ubuntu (13.04) / nginx / mono setup. It works when I set the socket on fastcgi-mono-server4 to TCP however I'd like to use a socket.

I'm starting it with this script which is run on startup:

#!/bin/sh

### BEGIN INIT INFO
# Provides:          monoserve.sh
# Required-Start:    $local_fs $syslog $remote_fs
# Required-Stop:     $local_fs $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start fastcgi mono server with hosts
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/mono
NAME=monoserver
DESC=monoserver

MONOSERVER=$(which fastcgi-mono-server4)
MONOSERVER_PID=$(ps auxf | grep fastcgi-mono-server4.exe | grep -v grep | awk '{print $2}')

WEBAPPS=":/usr/share/nginx/html/"

case "$1" in
        start)
                if [ -z "${MONOSERVER_PID}" ]; then
                        echo "starting mono server"
                        ${MONOSERVER} /applications=${WEBAPPS} /socket=unix:/var/run/mono.sock &
                        echo "mono server started"
                else
                        echo ${WEBAPPS}
                        echo "mono server is running"
                fi
        ;;
        stop)
                if [ -n "${MONOSERVER_PID}" ]; then
                        kill ${MONOSERVER_PID}
                        echo "mono server stopped"
                else
                        echo "mono server is not running"
                fi
        ;;
esac

exit 0

The issue is the /var/run/mono.sock file is created with permissions that don't allow nginx to access it. I'm not sure how to fix this issue. If I manually set the permissions to 666 nginx works. The permissions of the default sock file are: srwxr-xr-x

I also have php5-fpm on this server, and it's sock file is being created with the correct permissions all through it's start is going through start-stop-daemon.

Anyone have any ideas?

Was it helpful?

Solution

There will be a flag for this soon (thanks for the feedback). In the meantime you can umask 117 before running the server

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top