Skip to content

Instantly share code, notes, and snippets.

@mayoralito
Created March 15, 2018 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayoralito/41288a5af49608969af2b97b894e1154 to your computer and use it in GitHub Desktop.
Save mayoralito/41288a5af49608969af2b97b894e1154 to your computer and use it in GitHub Desktop.

Run nginx with docker (Basic Config)

docker run -d -p 1234:80 \
-v /Users/{username}/local/path1/:/usr/share/nginx/html/ \
-v /Users/{username}/local/path2/:/usr/share/nginx/html/subpath1 \
-v /Users/{username}/local/path3/:/usr/share/nginx/html/subpath2 \
-v /Users/{username}/local/pathN/:/usr/share/nginx/html/subpath2/subfolder \
--name webserver \
nginx

Open Port on Mac OS X (if neede)

sudo vim /etc/pf.conf

And add content below:

# Open port 1234 for TCP on all interfaces
pass in proto tcp from any to any port 1234

Save and Reboot

# Apply new config.
sudo pfctl -vnf /etc/pf.conf
# Restart computer.
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment