Reader small image

You're reading from  Linux Networking Cookbook

Product typeBook
Published inJun 2016
Publisher
ISBN-139781785287916
Edition1st Edition
Concepts
Right arrow
Authors (2):
Gregory Boyce
Gregory Boyce
author image
Gregory Boyce

Gregory Boyce is a technologist with nearly 20 years' experience using and managing Linux systems. When he's not at work or spending time with his wife and two daughters, he plays around with new technologies. Gregory has spent the last 15 years working at Akamai Technologies, where he has worked in roles ranging from Network Operations, Internal IT, Information Security, Software Testing, and Professional Services. Currently, he heads up the Linux OS team that manages Akamai's custom Linux operating system, which runs on their massively distributed customer-facing network.
Read more about Gregory Boyce

View More author details
Right arrow

Setting up PHP in NGINX with FastCGI


As we mentioned is an earlier chapter, linking modules into a multi-threaded HTTP server requires that the code in the module be thread safe. Nginx works around this by utilizing the fastcgi protocol to interact with interpreters rather than linking them directly into the process. This does not have quite the performance of the more native approach, but you can limit what content runs through the processor.

How to do it…

Configuring on Ubuntu 14.04:

  1. Install the PHP FastCGI wrapper:

    sudo apt-get install php5-fpm
    
  2. Modify php's configuration file to disable cgi.fix_pathinfo, this setting opens the door to security vulnerabilities by allowing PHP to guess at what your request was intending to request:

    sed 's/.*cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini
    service php5-fpm restart
    
  3. Configure nginx to talk to the php5-fpm daemon (default is /etc/nginx/sites-available/default) within the relevant server definitions:

    location ~ \.php$ {
      try_files...
lock icon
The rest of the page is locked
Previous PageNext Chapter
You have been reading a chapter from
Linux Networking Cookbook
Published in: Jun 2016Publisher: ISBN-13: 9781785287916

Authors (2)

author image
Gregory Boyce

Gregory Boyce is a technologist with nearly 20 years' experience using and managing Linux systems. When he's not at work or spending time with his wife and two daughters, he plays around with new technologies. Gregory has spent the last 15 years working at Akamai Technologies, where he has worked in roles ranging from Network Operations, Internal IT, Information Security, Software Testing, and Professional Services. Currently, he heads up the Linux OS team that manages Akamai's custom Linux operating system, which runs on their massively distributed customer-facing network.
Read more about Gregory Boyce