Windows 10 Home Docker Nginx 403 Forbidden

When you run a static website from nginx web server, you will sometimes see 403 Forbidden error message in the webpage.

 The reasons include web server permission, nevertheless the path can also be the cause as it actually does not exist. You have to create the path by yourself. This article aims to solve this problem.

Step 1:

Firstly download linux image:

Docker pull alpine

Alpine Linux is a micro operating system.

Step2:

Switch to linux environment

docker run -it alpine sh

Step3:

Create path

mkdir /usr/share/nginx/html

Step4:

Exit linux environment

Alpine exit

Step5:

Execute the following docker command

docker run –rm -it -p 5012:80 -v directory:/usr/share/nginx/html -d nginx

Then you will be able to see the webpage you expect

You can download the file that makes the webpage shown above from the pluralsight online courses(Getting Started with Docker on Windows).