Nginx_Fastcgi

[ Serveurs - Nginx - Php - Cgi - Fastcgi - TODO ]

Configurer PHP avec Fastcgi sous Nginx

En cours de rédaction.

#!/bin/bash                                                                                                                                                                     
 
COMMAND=/usr/bin/spawn-fcgi
ADDRESS=127.0.0.1
PORT=9000
USER=php-fcgi
GROUP=php-fcgi
PHPCGI=/usr/bin/php5-cgi
PIDFILE=/var/run/fastcgi-php.pid
RETVAL=0

ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
 
case "$1" in
    start)
      $ENV $COMMAND -a $ADDRESS -p $PORT -u $USER -g $GROUP -f $PHPCGI -P $PIDFILE
      RETVAL=$?
  ;;  
    stop)
      killall -9 php5-cgi
      RETVAL=$?
  ;;  
    restart)
      killall -9 php5-cgi
      $ENV $COMMAND -a $ADDRESS -p $PORT -u $USER -g $GROUP -f $PHPCGI -P $PIDFILE
      RETVAL=$?
  ;;  
    *)  
      echo "Usage: fastcgi {start|stop|restart}"
      exit 1
  ;;  
esac
exit $RETVAL
#!/bin/bash                                                                                                                                                                     
 
# nginxdissite
 
if [ -z $1 ]; then
        echo 
        echo "You must specify a site name"
        exit 0
fi
 
NGINX_CONF=/etc/nginx
CONF_FILE="$1"
AVAILABLE_PATH="$NGINX_CONF/sites-available/$CONF_FILE"
ENABLED_PATH="$NGINX_CONF/sites-enabled/$CONF_FILE"
    
echo  
if [ -e $ENABLED_PATH ]; then
        rm $ENABLED_PATH
    
        echo "$1 has been disabled"
        echo "run /etc/init.d/nginx reload to apply the changes"        
else  
        echo "$ENABLED_PATH does not exist, ignoring"
fi
#!/bin/bash                                                                                                                                                                     
 
# nginxensite
 
if [ -z $1 ]; then
        echo 
        echo "You must specify a site name"
        exit 0
fi
 
NGINX_CONF=/etc/nginx
CONF_FILE="$1"
AVAILABLE_PATH="$NGINX_CONF/sites-available/$CONF_FILE"
ENABLED_PATH="$NGINX_CONF/sites-enabled/$CONF_FILE"
    
echo  
if [ -e $AVAILABLE_PATH ]; then
        ln -s $AVAILABLE_PATH $ENABLED_PATH
    
        echo "$1 has been enabled"
        echo "run /etc/init.d/nginx reload to apply the changes"        
else  
        echo "$AVAILABLE_PATH does not exist"
        exit 1
fi

Source

Creative Commons License