Skip to content

Instantly share code, notes, and snippets.

@asherrard
Created February 22, 2016 20:49
Show Gist options
  • Save asherrard/424d5b39cdec262efa12 to your computer and use it in GitHub Desktop.
Save asherrard/424d5b39cdec262efa12 to your computer and use it in GitHub Desktop.
Shell script for installing php fast cgi update www-data:www-date with your web user / group
sudo apt-get -y install apache2-mpm-worker
sudo apt-get -y install libapache2-mod-fastcgi php5-fpm
sudo a2dismod php5 mpm_prefork
sudo a2enmod actions fastcgi alias mpm_worker
sudo touch /usr/lib/cgi-bin/php5.fcgi
sudo chown -R www-data:www-data /usr/lib/cgi-bin
cat <<EOF >/etc/apache2/conf-available/php5-fpm.conf
<IfModule mod_fastcgi.c>
AddHandler php5.fcgi .php
Action php5.fcgi /php5.fcgi
Alias /php5.fcgi /usr/lib/cgi-bin/php5.fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5.fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization -idle-timeout 3600
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>
EOF
sudo a2enconf php5-fpm
sudo service apache2 restart && sudo service php5-fpm restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment