Serve frontend projects on macOS using an nginx Docker container
Gill, Avtar
agill at ocadu.ca
Mon Jul 17 21:05:24 UTC 2017
Hi all,
You can use the following steps on macOS to serve a directory tree, as an alternative to using MAMP or managing a web server manually:
1. Pick a location in your filesystem that is going to be served by nginx, e.g. /Users/avtar/Projects
2. Select an unused port on your computer, e.g. 9999
3. Install Docker for Mac https://download.docker.com/mac/stable/Docker.dmg
4. Download and start a fork [1] of the official nginx Docker image:
docker run -d \
--name web-server \
-v /Users/avtar/Projects:/usr/share/nginx/html:ro \
-p 9999:80 \
--restart always \
jrelva/nginx-autoindex
5. Visit http://localhost:9999/
The container will start automatically when your computer boots up.
Avtar
[1] A fork of the official nginx image is being used because it modifies the nginx config to enable autoindexing of directories https://bitbucket.org/jrelva/docker-nginx-index/raw/505d6a2f9fad1b63c4bf348b2635257ee9ced9d5/Dockerfile
More information about the fluid-work
mailing list