Nginx webserver configuration: Difference between revisions
From WickyWiki
mNo edit summary |
mNo edit summary |
||
| Line 8: | Line 8: | ||
Note: | Note: | ||
* Ultimately | * Ultimately one [http://nginx.org/en/docs/http/ngx_http_core_module.html#location location] -context is selected to proces the request | ||
* | * Usually a request uri matches multiple location contexts, the selected context is based on a number of conditions. This depends on the option, length of the match, and order of appearance. | ||
* | * Location allows for a prefix $uri -match by default. Other possibilities are an exact match (option "=") or a regular expression (option "~") | ||
Understanding this, you may also understand that adding a new location can cause requests to be captured that were previously handled by other locations, breaking your setup. | |||
<source lang=bash> | <source lang=bash> | ||
Latest revision as of 15:05, 21 September 2023
Some notes on Nginx webserver configuration.
- https://www.digitalocean.com/community/tutorials/understanding-the-nginx-configuration-file-structure-and-configuration-contexts
- http://nginx.org/en/docs/beginners_guide.html
Note:
- Ultimately one location -context is selected to proces the request
- Usually a request uri matches multiple location contexts, the selected context is based on a number of conditions. This depends on the option, length of the match, and order of appearance.
- Location allows for a prefix $uri -match by default. Other possibilities are an exact match (option "=") or a regular expression (option "~")
Understanding this, you may also understand that adding a new location can cause requests to be captured that were previously handled by other locations, breaking your setup.
# http context
server {
#server 1 context
listen 8080;
server_name wjv.duckdns.org;
location /urimatch1 {
#virtual folder 1 context
root /var/www/html;
}
location <option> /urimatch2 {
#virtual folder 2 context
return 200 'document_root=$document_root<br/> request_filename=$request_filename<br/> uri=$uri<br/';
add_header Content-Type text/html;
}
}
server {
# server 2 context
listen 8081;
}