Php5 With Nginx + Fastcgi

  • Uploaded by: Krisna
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Php5 With Nginx + Fastcgi as PDF for free.

More details

  • Words: 180
  • Pages: 3
Nginx + PHP with FastCGI: # dpkg -i nginx_0.8.8-1~ppa1_i386.deb # dpkg -i spawn-fcgi_1.6.2-3~ppa3_i386.deb # dpkg -i php5-cgi_5.2.6-2ubuntu4.2_i386.deb # cp php5-fastcgi /etc/init.d/ # chmod a+x /etc/init.d/php5-fastcgi # update-rc.d -f php5-fastcgi defaults # /etc/init.d/php5-fastcgi start # cp default /etc/nginx/sites-available/ # cp phpinfo.php /var/www/ # /etc/init.d/nginx restart test with browser: http://localhost:82/phpinfo.php

Page 1 of 3

php5-fastcgi: #!/bin/bash BIND=127.0.0.1:9000 USER=www-data PHP_FCGI_CHILDREN=15 PHP_FCGI_MAX_REQUESTS=1000 PHP_CGI=/usr/bin/php-cgi PHP_CGI_NAME=`basename $PHP_CGI` PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND" RETVAL=0 start() { echo -n "Starting PHP FastCGI: " start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS RETVAL=$? echo "$PHP_CGI_NAME." } stop() { echo -n "Stopping PHP FastCGI: " killall -q -w -u $USER $PHP_CGI RETVAL=$? echo "$PHP_CGI_NAME." } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: php-fastcgi {start|stop|restart}" exit 1 ;; esac exit $RETVAL

Page 2 of 3

default: server { listen 82; server_name localhost; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; location / { root /var/www; index index.html index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; include fastcgi_params; } }

phpinfo.php:
Page 3 of 3

Related Documents


More Documents from ""