Problem
I have a Nginx container running in docker. It's configured to listen to port http://localhost:80 . When I type the url to my browser I get the following...
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com.
Thank you for using nginx.
Cont'd of Problem
I want nginx to serve my html files from my public directory. Please take a look at my project images...
Project Images:
Project directory
Nginx Container Running
What I have done
Ran the following docker command from my public directory...
Search for the location of nginx server from /usr/local/bin , /usr/private/var so that I can modify nginx.conf as described in the following post NGinx Default public www location?. I was unable to find the location of the nginx server.
Thanks in advance for taking the time to answer my question. I really appreciate you.
Serving Static Files To deploy the container, use Docker Compose. The Docker Compose output. Your static folder and all of its contents are now being served at http://localhost:8080/ using Nginx running inside Docker. Our static files being served on port 8080.
The default directory that static assets are served out of is /usr/share/nginx/html
, not /var/www
in the Official NGINX Docker image.
With that said, you're also mapping your entire root directory and not the /public/
folder where your folder contents live - unless of course you're running this from that directory on a pre-build image.
You'll probably want something like:
➜ docker run -p 80:80 -v $(pwd):/usr/share/nginx/html nginx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With