Nginx webserver configuration

From WickyWiki
Revision as of 14:37, 21 September 2023 by Wilbert (talk | contribs) (Created page with "Category:Raspberry Pi Category:Linux Category:202309 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 there is one location context selected to proces a request * It is possible that a request $uri matches multiple location contexts, in that case a context is selecte...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Some notes on Nginx webserver configuration.

Note:

  • Ultimately there is one location context selected to proces a request
  • It is possible that a request $uri matches multiple location contexts, in that case a context is selected, based on a number of conditions: options, length of the match, order of appearance
# 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;
}