You are previewing Nginx HTTP Server.

Nginx HTTP Server

Cover of Nginx HTTP Server by Clement Nedelcu Published by Packt Publishing
  1. Nginx HTTP Server
    1. Nginx HTTP Server
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
    6. 1. Preparing your Work Environment
      1. Setting up a terminal emulator
      2. Basic shell commands
      3. Discovering the Linux filesystem
      4. System administration tools
      5. Summary
    7. 2. Downloading and Installing Nginx
      1. Setting up the prerequisites
      2. Downloading Nginx
      3. Configure options
      4. Controlling the Nginx service
      5. Adding Nginx as a system service
      6. Summary
    8. 3. Basic Nginx Configuration
      1. Configuration file syntax
      2. Base module directives
      3. A configuration for your profile
      4. Testing your server
      5. Summary
    9. 4. HTTP Configuration
      1. HTTP Core module
      2. Module directives
      3. Module variables
      4. The Location block
      5. Summary
    10. 5. Module Configuration
      1. Rewrite module
      2. SSI module
      3. Additional modules
      4. Summary
    11. 6. PHP and Python with Nginx
      1. Introduction to FastCGI
      2. PHP with Nginx
      3. Python and Nginx
      4. Summary
    12. 7. Apache and Nginx Together
      1. Nginx as reverse proxy
      2. Nginx Proxy module
      3. Configuring Apache and Nginx
      4. Additional steps
      5. Summary
    13. 8. From Apache to Nginx
      1. Nginx versus Apache
      2. Porting your Apache configuration
      3. Rewrite rules
      4. Summary
    14. A. Directive Index
    15. B. Module Reference
      1. Access
      2. Addition*
      3. Auth_basic module
      4. Autoindex
      5. Browser
      6. Charset
      7. Core
      8. DAV*
      9. Empty GIF
      10. Events
      11. FastCGI
      12. FLV*
      13. Geo
      14. Geo IP*
      15. Google-perftools*
      16. Gzip
      17. Gzip Static*
      18. Headers
      19. HTTP Core
      20. Image Filter*
      21. Index
      22. Limit Requests
      23. Limit Zone
      24. Log
      25. Map
      26. Memcached
      27. Proxy
      28. Random index*
      29. Real IP*
      30. Referer
      31. Rewrite
      32. Secure Link*
      33. SSI
      34. SSL*
      35. Stub status*
      36. Substitution*
      37. Upstream
      38. User ID
      39. XSLT*
    16. C. Troubleshooting
      1. General tips on troubleshooting
O'Reilly logo

PHP with Nginx

We are now going to configure PHP to work together with Nginx via FastCGI. There are some very particular steps involved in the design of such a setup; the most bothersome being that you, most likely, cannot utilize your current build of PHP. This issue, among others, will be addressed throughout this section.

Architecture

Before starting the setup process, it's important to understand the way PHP will interact with Nginx. We have established that FastCGI is a communication protocol running through sockets, which implies that there is a client and a server. The client is obviously Nginx; as for the server, well, the answer is actually more complicated than just PHP.

By default, PHP supports the FastCGI protocol. The PHP binary processes ...

The best content for your career. Discover unlimited learning on demand for around $1/day.