Skip to content

Instantly share code, notes, and snippets.

@kirilkirkov
Last active September 14, 2023 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirilkirkov/de0d3c41b64d8ade3b47b7739797639f to your computer and use it in GitHub Desktop.
Save kirilkirkov/de0d3c41b64d8ade3b47b7739797639f to your computer and use it in GitHub Desktop.
Sequence of Processing When Opening a Website with NGINX and PHP

Sequence of Processing When Opening a Website with NGINX and PHP (No Opcache Activated)

**Client's Browser**
    |
    |   DNS
    |
    v
**Website Server**
    |
    |   
    |   No match in OPCache
    |   
    v
**Start of Request**
    |
    v
**NGINX**
    |
    |   
    |   Static Resource
    |
    v
**NGINX returns static response**
    |
    |   
    |   Dynamic Script
    |
    v
**NGINX**
    |
    |   
    |   
    |   Request for PHP script and no match in OPCache
    |   
    |   
    v
**PHP-FPM executes PHP code**
    |
    v
**NGINX returns PHP response**
    |
    v
**Client's Browser**

Sequence of Processing When Opening a Website with NGINX, PHP, OPCache, and JIT

**Client's Browser**
    |
    |     DNS
    |
    v
**Website Server**
    |
    |  
    |    OPCache contains cached bytecode
    |   
    |    
    v
**Start of Request**
    |
    v
**NGINX**
    |
    |    Static Resource
    | 
    |
    v
**NGINX returns static response**
    |
    |   
    |    Dynamic Script
    |
    v
**NGINX**
    |
    |   
    |   
    |   Request for PHP script and OPCache contains cached bytecode
    |   
    |   
    |   
    v
**PHP-FPM executes PHP code**
    |
    v
**OPCache returns bytecode**
    |
    |  
    |    JIT compilation
    |
    v
**NGINX returns executable code**
    |
    v
**Client's Browser**

Sequence of Processing When Opening a Website with NGINX, PHP, and OPCache

**Client's Browser**
    |
    |    DNS
    |
    v
**Website Server**
    |
    |    
    |    OPCache contains cached bytecode
    |    
    |    
    v
**Start of Request**
    |
    v
**NGINX**
    |
    | 
    |    Static Resource
    |
    v
**NGINX**
**returns**
**static**
**response**
    |
    |   
    |   Dynamic Script
    |
    v
**NGINX**
    |
    |   
    |   
    |   Request for PHP script and OPCache contains cached bytecode
    |   
    |   
    |   
    v
**PHP-FPM**
**executes**
**PHP code**
    |
    v
**NGINX**
**returns**
**PHP**
**response**
    |
    v
**Client's**
**Browser**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment