diff options
| author | Luke Smith <Luke Smith> | 2022-06-30 15:59:29 -0400 |
|---|---|---|
| committer | Luke Smith <Luke Smith> | 2022-06-30 15:59:29 -0400 |
| commit | ec0a3bfe3d17647b1eead525c719432f02ad3da9 (patch) | |
| tree | cb251c4ac0057acc848337cd90138fe80d2028d2 /content/nginx-tweaks.md | |
| parent | 98fa01c53248997fa5820680e32490467cee5773 (diff) | |
fosspay released after testing
Diffstat (limited to 'content/nginx-tweaks.md')
| -rw-r--r-- | content/nginx-tweaks.md | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/content/nginx-tweaks.md b/content/nginx-tweaks.md index 8d4dcb8..8e85af5 100644 --- a/content/nginx-tweaks.md +++ b/content/nginx-tweaks.md @@ -2,19 +2,19 @@ title: "Nginx Tweaks" date: 2022-06-16 --- -The point of this article is to show you how to do some commonly-desired -tweaks in Nginx while in the meantime helping you understand how it -works. + +The point of this article is to show you how to do some commonly-desired tweaks +in Nginx while in the meantime helping you understand how it works. ## Do not require `.html` in URLs If your website is using lots of `.html` files for pages, it\'s sort of -overkill to make people type that in for every page they are looking -for. We can remove that requirement with Nginx. +overkill to make people type that in for every page they are looking for. We +can remove that requirement with Nginx. -Open your site\'s configuration file in `/etc/nginx/sites-enabled/` and -within the `server` block, there should be a `location` block that looks -something like this if you have followed [the guide here](/basic/nginx). +Open your site\'s configuration file in `/etc/nginx/sites-enabled/` and within +the `server` block, there should be a `location` block that looks something +like this if you have followed [the guide here](/basic/nginx). ```nginx location / { @@ -23,15 +23,14 @@ location / { ``` What this means is that in the file location of `/`, i.e. anywhere and -everywhere in the root file system, We will look for the three things -listed in `try_files` in that order: +everywhere in the root file system, We will look for the three things listed in +`try_files` in that order: -1. `$uri`: a file that directly matches the content added after the +1. `$uri`: a file that directly matches the content added after the domain. +2. `$uri/`: a *directory* that directly matches the content added after the domain. -2. `$uri/`: a *directory* that directly matches the content added after - the domain. -3. `=404`: if neither of those is found, we give a 404 error, which as - you probably know, signified \"Page not found.\" +3. `=404`: if neither of those is found, we give a 404 error, which as you + probably know, signified \"Page not found.\" We will now change the content inside the `location` block to the below: @@ -42,5 +41,5 @@ location / { } ``` -`$1` here refers to the first content in the parentheses `()` in the -preceeding regular expression. +`$1` here refers to the first content in the parentheses `()` in the preceeding +regular expression. |
