美文网首页
2024-11-13 install map server on

2024-11-13 install map server on

作者: claylee | 来源:发表于2024-11-12 17:14 被阅读0次

添加 init.d 文件

在/etc/init.d/ 文件夹添加 文件 mapserv

#!/usr/bin/env sh
#
# description: Mapserver Service Manager
# processname: lt-mapserv
# pidfile: /var/run/mapserv.pid
# Source function library.
#. /etc/init.d/functions
# Check that networking is up.
#. /etc/sysconfig/network
if [ "$NETWORKING" = "no" ]
then
    exit 0
fi
PREFIX=/usr
NAME=mapserv
PID=/var/run/mapserv.pid
DAEMON=$PREFIX/bin/spawn-fcgi
DAEMON_OPTS=" -a 127.0.0.1 -p 9999 -F 4 -u www-data -U www-data -P $PID $PREFIX/bin/mapserv"
start () {
    echo -n $"Starting $NAME "
        exec $DAEMON $DAEMON_OPTS >> /dev/null
        daemon --pidfile $PID
        RETVAL=$?
        echo
    [ $RETVAL -eq 0 ]
}
stop () {
    echo -n $"Stopping $NAME "
        killproc -p $PID
        #make sure all mapservers are closed
        pkill -f lt-mapserv
        RETVAL=$?
        echo
    if [ $RETVAL -eq 0 ] ; then
        rm -f $PID
    fi
}
restart () {
    stop
    start
}
# See how we were called.
case "$1" in
    start)
        start
    ;;
    stop)
        stop
    ;;
    status)
        status lt-mapserv
        RETVAL=$?
    ;;
    restart)
        restart
    ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart}"
        RETVAL=2
    ;;
esac
exit $RETVAL

修改nginx 配置

在 nginx 配置文件中添加一下内容

server
{
    listen      80;
    charset     utf-8;
    server_name localhost;


    location / {
        fastcgi_pass 127.0.0.1:9999;
        include /etc/nginx/fastcgi_params;
        fastcgi_params SCRIPT_NAME /usr/bin/mapserv$fastcgi_script_name;
    }
}

相关文章

网友评论

      本文标题:2024-11-13 install map server on

      本文链接:https://www.haomeiwen.com/subject/tnwljjtx.html