Difference between revisions of "Nginx"
Jump to navigation
Jump to search
(Created page with "==General== * HTTP and reverse proxy server, mail proxy server * Employs event-based model and OS-dependent mechanisms to efficiently distribute requests among worker processe...") |
|||
Line 2: | Line 2: | ||
* HTTP and reverse proxy server, mail proxy server | * HTTP and reverse proxy server, mail proxy server | ||
* Employs event-based model and OS-dependent mechanisms to efficiently distribute requests among worker processes | * Employs event-based model and OS-dependent mechanisms to efficiently distribute requests among worker processes | ||
+ | * [http://nginx.org/en/docs/ docs] | ||
* [http://nginx.org/en/docs/beginners_guide.html Beginner's Guide] | * [http://nginx.org/en/docs/beginners_guide.html Beginner's Guide] | ||
* [http://nginx.org/en/docs/dirindex.html Alphabetical List of Directives] | * [http://nginx.org/en/docs/dirindex.html Alphabetical List of Directives] | ||
Line 8: | Line 9: | ||
==Configuration File== | ==Configuration File== | ||
* Comments start with hash # | * Comments start with hash # | ||
− | ===Structure== | + | ===Structure=== |
* nginx modules controlled by directives | * nginx modules controlled by directives | ||
* two types of directives: simple and block directives | * two types of directives: simple and block directives | ||
Line 19: | Line 20: | ||
* top-level "main" context, cannot be within another | * top-level "main" context, cannot be within another | ||
====server==== | ====server==== | ||
− | * | + | * Within http context only |
− | * | + | * Can have multiple server names |
* Once nginx decides which server will process the request, it tests the URI specified in the request's header against the location directives defined in the server block. | * Once nginx decides which server will process the request, it tests the URI specified in the request's header against the location directives defined in the server block. | ||
+ | ** Order of precedence is longest to shortest prefix, so location '/' will match last. | ||
====location==== | ====location==== | ||
− | * | + | * Within server context only |
− | * | + | * Performs mapping of URL to route to static files on server, or proxy, etc. |
* <code>location URIPREFIXARG { root /path/to/static/files;}</code> | * <code>location URIPREFIXARG { root /path/to/static/files;}</code> | ||
==Setup== | ==Setup== | ||
* [https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7 LEMP stack on CentOS7] | * [https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7 LEMP stack on CentOS7] |
Revision as of 17:09, 27 August 2019
Contents
General
- HTTP and reverse proxy server, mail proxy server
- Employs event-based model and OS-dependent mechanisms to efficiently distribute requests among worker processes
- docs
- Beginner's Guide
- Alphabetical List of Directives
- Master process - read and evaluate configuration, and maintain worker processes
- Worker processes - do actual processing of requests; # is defined in the configuration file
Configuration File
- Comments start with hash #
Structure
- nginx modules controlled by directives
- two types of directives: simple and block directives
- simple directive - directive name, followed by params, ends with a semicolon
- block directives ("context") - same as simple, but instead of semicolon ends with curly braces
Contexts
events
- top-level "main" context, cannot be within another
http
- top-level "main" context, cannot be within another
server
- Within http context only
- Can have multiple server names
- Once nginx decides which server will process the request, it tests the URI specified in the request's header against the location directives defined in the server block.
- Order of precedence is longest to shortest prefix, so location '/' will match last.
location
- Within server context only
- Performs mapping of URL to route to static files on server, or proxy, etc.
location URIPREFIXARG { root /path/to/static/files;}