Я уже два дня пытаюсь установить Sympa Mailing List (написанный на Perl) и столкнулся с проблемой, которую не могу понять. Я установил пакет sympa debian, который включает wwsympa, и настроил сценарий System V для запуска wwsympa. Ошибка, которую я получаю в nginx:
[error] 4807#4807: *1 connect() to unix:/var/run/sympa/wwsympa.socket failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: 127.0.0.1, request: "GET /sympa HTTP/1.1", upstream: "fastcgi://unix:/var/run/sympa/wwsympa.socket:", host: "127.0.0.1"
Это файл инициализации System V для сокета:
#!/bin/sh
#
# wwsympa Sympa Web Interface
#
# Written by IKEDA Soji 2011-10-20
#
# chkconfig: 345 95 05
# description: sympa is a powerful mailing lists management system.
if [ -f /etc/rc.d/init.d/functions ]; then
# Source function library.
. /etc/rc.d/init.d/functions
## Set a flag
use_functions=1
fi
# WWSympa parameters
# WWSympa binaries directory
sympafcgidir="/usr/lib/cgi-bin/sympa"
# Sympa config files directory
sympaconf="/etc/sympa/sympa.conf"
FCGI_CHILDREN=5
FCGI_USER=sympa
FCGI_GROUP=sympa
FCGI_PID_DIR=/var/run/sympa
FCGI_OPTS='-s /var/run/sympa/wwsympa.socket -M 0777 -U sympa'
if [ -e /etc/sysconfig/sympa ]; then
. /etc/sysconfig/sympa
fi
# Current state of WWSympa
wwsympa_status() {
if [ ${use_functions} ]; then
status wwsympa
else
if [ -f ${FCGI_PID_DIR}/wwsympa.pid ]; then
pid=`cat ${FCGI_PID_DIR}/wwsympa.pid | perl -pe0777 'chomp $_; s/\s+/|/g'`
if [ "$pid" != "" ]; then
running=`ps -A | egrep "$pid"`
if [ "$running" != "" ]; then
echo "$1 (pid(s) $pid) is active..."
return 0
else
echo "$1 died, pid file remains."
return 1
fi
fi
fi
echo "$1 is stopped."
return 3
fi
}
# Start WWSympa
wwsympa_start() {
wwsympa_status > /dev/null
rc=$?
case "$rc" in
3)
echo -n "Starting wwsympa: "
;;
1)
echo -n "Starting wwsympa, overwriting old pid file."
;;
0)
echo "WWSympa seems active. No action will be taken."
echo "Try \"wwsympa status\" or \"wwsympa restart"\".
return
esac
/usr/bin/spawn-fcgi -F ${FCGI_CHILDREN} -P ${FCGI_PID_DIR}/wwsympa.pid \
-u ${FCGI_USER} -g ${FCGI_GROUP} ${FCGI_OPTS} -- \
${sympafcgidir}/wwsympa.fcgi
}
# Stop WWSympa
wwsympa_stop() {
if [ -f ${FCGI_PID_DIR}/wwsympa.pid ]; then
runcount=0
pids=`cat ${FCGI_PID_DIR}/wwsympa.pid`
if [ "$pids" != "" ]; then
for pid in "$pids"; do
killcount=0
running=`ps -A | grep "$pid ..* wwsympa"`
while [ "$running" != "" ]; do
if [ $killcount -gt 10 ]; then
if [ ${use_functions} ]; then
failure
else
echo 'failure'
fi
return 3
fi
kill -TERM $pid >/dev/null 2>&1
running=`ps -A | grep "$pid ..* $1\\.pl"`
if [ "$running" = "" ]; then
runcount=`expr $runcount + 1`
break
fi
sleep 2
running=`ps -A | grep "$pid ..* $1\\.pl"`
if [ "$running" = "" ]; then
runcount=`expr $runcount + 1`
break
fi
killcount=`expr $killcount + 1`
done
done
fi
if [ $runcount -gt 0 ]; then
if [ ${use_functions} ]; then
success
else
echo 'success'
fi
else
echo 'died'
fi
echo
else
echo "Module $1.pl not running"
fi
return 0
}
# Check config files
[ -d $sympafcgidir ] || exit 0
[ -f $sympaconf ] || exit 0
# See how we were called.
case "$1" in
start)
if [ ! -f /var/lock/subsys/wwsympa ]; then
echo "Starting WWSympa: "
wwsympa_start
touch /var/lock/subsys/wwsympa
echo
else
echo "WWSympa seems active. No action will be taken."
echo "Try \"wwsympa status\" or \"wwsympa restart"\".
fi
;;
stop)
echo "Stopping WWSympa: "
wwsympa_stop
if [ -f /var/lock/subsys/wwsympa ]; then
rm -f /var/lock/subsys/wwsympa
fi
;;
status)
echo "Status of WWSympa: "
wwsympa_status
;;
restart)
echo "Restarting WWSympa: "
$0 stop && $0 start
echo
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0
Что у меня в / var / run / sympa / dir
total 24
-rw-r--r-- 1 sympa sympa 5 Feb 7 02:48 archived.pid
-rw-r--r-- 1 sympa sympa 5 Feb 7 02:48 bounced.pid
-rw-r--r-- 1 sympa sympa 5 Feb 7 02:48 bulk.pid
-rw-r--r-- 1 sympa sympa 5 Feb 7 02:48 sympa.pid
-rw-r--r-- 1 sympa sympa 5 Feb 7 02:48 task_manager.pid
-rw-r--r-- 1 root root 0 Feb 7 05:06 text.tt
-rw-r--r-- 1 sympa sympa 24 Feb 7 02:48 wwsympa.pid
srwxrwxrwx 1 sympa sympa 0 Feb 7 02:48 wwsympa.socket
Моя конфигурация nginx:
server {
listen 80 default_server;
root /var/www/html;
server_name 127.0.0.1;
location / {
include sympa_fcgi.conf;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location /sympa {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/sympa/wwsympa.socket;
include /etc/nginx/fastcgi_params;
# If you changed wwsympa_url in sympa.conf, change this regex too!
fastcgi_split_path_info ^(/sympa)(.*)$;
fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/sympa/wwsympa.fcgi;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location /static-sympa {
alias /var/lib/sympa/static_content;
}
}