Differences between revisions 1 and 25 (spanning 24 versions)
Revision 1 as of 2020-01-20 07:16:38
Size: 165
Comment:
Revision 25 as of 2023-08-06 18:16:32
Size: 2057
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= NGINX = = Nginx =
Line 3: Line 3:
A modern web server. '''`nginx(8)`''' is a web and proxy server written for modern workloads (chiefly multi-threading).

<<TableOfContents>>

----



== Installation ==

Most [[Linux]] and [[BSD]] distributions offer a `nginx` package.

On [[Linux/Ubuntu|Ubuntu]], to ensure all security patches have been applied, use the upstream PPA.

{{{
sudo add-apt-repository ppa:nginx/stable
sudo apt update
sudo apt install nginx
}}}



=== Containers ===

[[Docker]] container images are also available for the last two versions. The image is available from [[Docker/Hub|DockerHub]] as `docker.io/library/nginx` (or simply `nginx` when using `docker(1)` specifically).

Try:

{{{
docker run --detach --name my-nginx \
  --mount type=bind,src=/path/to/web/root,dst=/usr/share/nginx/html,readonly \
  --publish 127.0.0.1:8080:80 \
  nginx:latest
}}}

----

Line 7: Line 44:
=== Server blocks === To check the configuration of `nginx(8)`, run...
Line 9: Line 46:
=== Location blocks === {{{
nginx -t
}}}
Line 11: Line 50:
=== Restricting Access ===

=== Syntax ===

 * [[Nginx/Location|Location]]
 * [[Nginx/Http|Http]]
 * [[Nginx/RewritingAndReturning|Rewriting and Returning]]
 * [[Nginx/Server|Server]]
 * [[Nginx/TryFiles|Try Files]]



=== Proxying ===

 * [[Nginx/FastCGI|FastCGI]]
 * [[Nginx/Uwsgi|Uwsgi]]



=== Advanced Configuration ===

 * [[Nginx/Authentication|Authentication]]
 * [[Nginx/ClientCaching|Client Caching]]
 * [[Nginx/Compression|Compression]]
 * [[Nginx/Encryption|Encryption]]



=== Restricting Referrers ===

It is sometimes desirable to block referrals.

{{{
valid_referers none blocked server_names
               ~example\.com;
if ($invalid_referer) {
    return 403;
}
}}}

`none` matching missing referers (`"-"`), while `blocked` matches referers that have been deleted by a firewall.

Literal server names are given with a leading or trailing asterisk (`*`). Regular expressions are given with a leading tilde (`~`).

----



== See also ==

[[https://man.archlinux.org/man/extra/nginx/nginx.8.en|nginx(8)]]


Nginx

nginx(8) is a web and proxy server written for modern workloads (chiefly multi-threading).


Installation

Most Linux and BSD distributions offer a nginx package.

On Ubuntu, to ensure all security patches have been applied, use the upstream PPA.

sudo add-apt-repository ppa:nginx/stable
sudo apt update
sudo apt install nginx

Containers

Docker container images are also available for the last two versions. The image is available from DockerHub as docker.io/library/nginx (or simply nginx when using docker(1) specifically).

Try:

docker run --detach --name my-nginx \
  --mount type=bind,src=/path/to/web/root,dst=/usr/share/nginx/html,readonly \
  --publish 127.0.0.1:8080:80 \
  nginx:latest


Configuration

To check the configuration of nginx(8), run...

nginx -t

Syntax

Proxying

Advanced Configuration

Restricting Referrers

It is sometimes desirable to block referrals.

valid_referers none blocked server_names
               ~example\.com;
if ($invalid_referer) {
    return 403;
}

none matching missing referers ("-"), while blocked matches referers that have been deleted by a firewall.

Literal server names are given with a leading or trailing asterisk (*). Regular expressions are given with a leading tilde (~).


See also

nginx(8)


CategoryRicottone

Nginx (last edited 2023-08-06 18:16:32 by DominicRicottone)