Nginx webserver configuration

From WickyWiki
Revision as of 14:49, 21 September 2023 by Wilbert (talk | contribs)


Some notes on Nginx webserver configuration.

Note:

  • Ultimately 1 location contexts 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, like: options, length of the match, order of appearance
  • location allows for a prefix $uri match by default. Other possibilities are an exact match (option "=") or a regular expression (option "~")
# 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;
}