Nginx in Docker

Updated: 05 April 2024

Run the latest version of the Nginx web-server in a docker container. The default Nginx page with be at http://localhost

docker run --rm -p 80:80 --name our_ws nginx

By default, Nginx looks in /usr/share/nginx/html for files to serve. So, mount our own content at that location

docker run --rm -p 80:80 --name our_ws -v $PWD:/usr/share/nginx/html nginx

Nginx

Updated: 02 March 2026

https://www.digitalocean.com/community/tools/nginx
https://ssl-config.mozilla.org/


Validate the Nginx configuration files, from the command line

nginx -t

After a change in configuration, reload

sudo systemctl reload nginx

Restart Nginx

sudo systemctl restart nginx

See which modules (e.g. rewrite) are compiled into the binary at install time

nginx -V

Add a header from nginx conf, always, regardless of response code

add_header X-Chris-Debug "$uri" always;
add_header X-Chris-Debug "this location read" always;