Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
NGINX HTTP Request Stages

NGINX actual HTTP Request processing flow is divided into 11 stages.

The reason for this division is to perform logical subdivision request to the module as a processing unit, the various stages can contain any number of HTTP modules and pipelined manner request.

The advantage of this is to make the process more flexible, reducing the degree of coupling.

These 11 HTTP stages are as follows:

  1. NGX_HTTP_POST_READ_PHASE ― The phase of the read request;
  2. NGX_HTTP_SERVER_REWRITE_PHASE ― The URI conversion phase at the server level;
  3. NGX_HTTP_FIND_CONFIG_PHASE ― Search out the configuration in which the request will be processed;
  4. NGX_HTTP_REWRITE_PHASE ― URI conversion phase at location level;
  5. NGX_HTTP_POST_REWRITE_PHASE ― The processing phase of the request URI conversion result;
  6. NGX_HTTP_PREACCESS_PHASE ― Preparation phase for access control;
  7. NGX_HTTP_ACCESS_PHASE ― Access verification phase;
  8. NGX_HTTP_POST_ACCESS_PHASE ― Phase processing of the results of the access check;
  9. NGX_HTTP_TRY_FILES_PHASEtry_files processing phase;
  10. NGX_HTTP_CONTENT_PHASE ― Response generation phase;
  11. NGX_HTTP_LOG_PHASE ― Log recording phase;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment