`

fastcgi init script on centos加强版

阅读更多
#!/bin/bash
#
# fcgi     Startup script for fcgi
#
# processname: fcgi

# Source function library
. /etc/rc.d/init.d/functions

## ABSOLUTE path to the spawn-fcgi binary
SPAWNFCGI="/opt/app/lighttpd/bin/spawn-fcgi"

## ABSOLUTE path to the PHP binary
FCGIPROGRAM="/opt/app/php-cgi/bin/php-cgi"

## TCP port to which to bind on localhost
#FCGIPORT="1026"
FCGI_SOCKET="/tmp/php-fastcgi.sock"

FCGI_PIDFILE="/var/run/spawn-fcgi.pid"

## number of PHP children to spawn
PHP_FCGI_CHILDREN=20

## maximum number of requests a single PHP process can serve before it is restarted
PHP_FCGI_MAX_REQUESTS=500

## IP addresses from which PHP should access server connections
FCGI_WEB_SERVER_ADDRS="127.0.0.1"

# allowed environment variables, separated by spaces
ALLOWED_ENV="SHELL PATH USER"

## if this script is run as root, switch to the following user
USERID=rsync
GROUPID=daemon


################## no config below this line

if test x$PHP_FCGI_CHILDREN = x; then
  PHP_FCGI_CHILDREN=5
fi

export PHP_FCGI_MAX_REQUESTS
export FCGI_WEB_SERVER_ADDRS


ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS"
if test x$UID = x0; then
  #EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN"
  EX="$SPAWNFCGI -s $FCGI_SOCKET -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE"
else
  #EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN"
  EX="$SPAWNFCGI -s $FCGI_SOCKET -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE"
fi

# copy the allowed environment variables
E=

for i in $ALLOWED_ENV; do
  E="$E $i=${!i}"
done

# clean the environment and set up a new one
#env - $E $EX




prog="fcgi" 



RETVAL=0

start() {
        echo -n $"Starting $prog: " 
        daemon env - $E $EX
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: " 
        rm -f $FCGI_PIDFILE $FCGI_SOCKET
        killproc $FCGIPROGRAM
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
        return $RETVAL
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                start
                ;;
        condrestart)
                if [ -f /var/lock/subsys/$prog ]; then
                        stop
                        start
                fi
                ;;
        status)
                status $FCGIPROGRAM
                RETVAL=$?
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart|condrestart|status}" 
                RETVAL=1
esac

exit $RETVAL

 放在/etc/init.d/下面,方便

0
0
分享到:
评论

相关推荐

    centos的nginx+php的fastcgi模式编译安装

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } ``` - 配置Nginx日志、错误日志、访问控制等其他设置。 6. **启动与测试**: - 启动Nginx和PHP-FPM服务。 -...

    CentOS+nginx+fastCGI+mysql配置文档

    在本配置文档中,我们将详细讨论如何在 CentOS 系统上搭建一个基于 Nginx、FastCGI 和 MySQL 的服务器环境。这个配置过程涉及到多个步骤,包括安装必要的软件包、配置 Nginx 以及整合 PHP 和 MySQL。 首先,我们...

    CentOS 6.1 环境中部署nginx、php(包括fastcgi)、虚拟主机配置

    - `SCRIPT_FILENAME $document_root$fastcgi_script_name` - `SCRIPT_NAME $fastcgi_script_name` - `QUERY_STRING $query_string` - `CONTENT_TYPE $content_type` - `CONTENT_LENGTH $content_length` 4. **...

    mod_fastcgi-2.4.6.tar.gz

    AddHandler fastcgi-script .fcgi # you can put whatever extension you want FastCgiIpcDir /tmp FastCgiServer /home/m/Dev/cvs/ImRoBot5/shdaily/cgi/shdaily.fcgi -processes 1 -idle-timeout 1000

    nginx FastCGI错误Primary script unknown解决办法

    在使用Nginx作为Web服务器时,经常会遇到一个名为FastCGI错误的问题,其中“Primary script unknown”是一个典型的错误提示。这个错误通常发生在尝试运行PHP脚本时,Nginx无法正确找到执行的主脚本文件。为了解决这...

    fastcgi-2.4.0安装包

    这些可以通过运行`sudo apt-get install build-essential`(对于Debian/Ubuntu)或`yum install gcc`(对于CentOS/RHEL)来安装。 2. **解压文件**:在Windows环境下,使用WinRAR、7-Zip或其他解压缩工具打开`fcgi-...

    Centos7.9安装zabbix6.0LTS版

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } ``` 隐藏 Nginx 信息 在文件 `/nginx/src/http/ngx_http_header_filter_module.c` 中,修改以下内容: ``` ...

    centos6.5安装LNMP服务器教程

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } ``` 2. **重启 Nginx 服务**: ```bash service nginx restart ``` #### 十、测试 PHP 1. **创建 PHP 测试...

    centOS6.5安装LNMP

    fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; include fastcgi_params; } ``` 3. **重启Nginx**:应用配置后,重启Nginx使配置生效:`service nginx restart`。 至此,一个基本的LNMP环境...

    fastcgi c++

    fastcgi fastcgi fastcgi fastcgi fastcgi

    centos7安装LNMP服务器教程

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } ``` #### 十二、总结 本教程详细介绍了如何在 CentOS 7 系统下搭建 LNMP 服务器环境。通过以上步骤,您已经...

    centos nginx安装包

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } ``` 重启Nginx和PHP-FPM服务: ```bash sudo systemctl restart nginx sudo systemctl restart php-fpm ``` ...

    Fastcgi学习总结(C/C++语言版)

    FastCGI是一种高性能的Web服务器接口,它是CGI(通用网关接口)的增强版本,旨在解决传统CGI性能上的问题。FastCGI程序能够长时间运行,而不是每次用户请求时都创建新的进程,从而提高了效率并降低了服务器负载。...

    linux运维笔记:Centos6.9之yum安装LNMP.docx

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } ``` 2. 启动Nginx 启动Nginx服务,命令如下: ``` service nginx start ``` 3. 测试Nginx服务 在浏览器中,...

    CentOS6安装PHP7+Nginx配置

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } ``` ### 测试配置并重启服务 测试Nginx配置是否正确: ```bash nginx -t ``` 如果没有错误,重启Nginx和PHP-FPM服务: ```bash ...

    FastCGI手册

    - **可扩展性**:FastCGI应用程序可以部署在集群中的任意服务器上,增强了系统的扩展性和灵活性。 #### 二、FastCGI的技术原理 FastCGI的核心思想是保持进程的持久性。当一个FastCGI进程被创建后,它可以持续工作...

    FastCGI 下载FastCGI for IIS6下载 1.5(32位&64位)

    **FastCGI技术详解** FastCGI是一种常用于提高Web服务器性能的技术,它作为一个接口,允许Web服务器与外部应用程序(如PHP解释器)进行高效通信。FastCGI的主要优势在于它可以长时间保持活动状态,避免了每次请求都...

    CentOS_6.2_yum安装配置lnmp服务器(Nginx+PHP+MySQL).doc

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } ``` 重启Nginx使更改生效: ```bash /etc/init.d/nginx restart ``` 至此,我们已经成功配置了LNMP环境。现在...

    FastCGI SDK

    **FastCGI SDK详解** FastCGI是一种常用于Web服务器上的接口协议,它允许外部程序(如PHP、Perl、Python等脚本语言解释器)作为Web服务器的动态内容生成器,提高了网站性能和响应速度。FastCGI的核心设计目标是避免...

Global site tag (gtag.js) - Google Analytics