About

The automated build docker Nginx image “linuxconfig/nginx” can be used as a basic testing environment for a static websites deployments.

Configuration

The image is build based on default Nginx webserver configuration running on Debian GNU/Linux. Nginx webserver run in foreground and listens on default port 80.

Usage

Create a directory and place your static website within.
$ mkdir html
$ echo "My Static Website" > html/index.html
OR
$ cp -r /path/to/your/static/website/* html/
Deploy nginx docker container based on “linuxconfig/nginx” docker image.
$ sudo docker run -d --name=nginx -p 80 -v $PWD/html:/var/www/html linuxconfig/nginx
The above command will deploy a new docker container named nginx. Check a port redirection from random local port to port 80 within nginx container:
$ sudo docker port nginx
80/tcp -> 0.0.0.0:49153
At this stage you will be able to access your static website via a local port 49153 on your host system:
$ curl http://localhost:49153
Nginx Docker Container
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.