Minimal local nginx setup using Docker

If you have not installed Docker, see our guide at How to install docker and docker-compose on Ubuntu in 30 seconds

  1. Create your nginx config file (my-nginx.conf). This is a template that reverse proxys TechOverflow:
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    location / {
        proxy_pass https://techoverflow.net;
        proxy_http_version 1.1;
    }
}
  1. Start nginx using docker:
docker run -it -p 80:80 --rm -v $(pwd)/my-nginx.conf:/etc/nginx/conf.d/default.conf nginx:latest
  1. Go to http://localhost and see the result!

Explanation of the docker command:

Explanation of the nginx config file: