Skip to content
Advertisement

How can you serve a folder of files with Nginx?

I’m trying to serve a folder that contains HTML, JS, PHP, Java, and a couple of other different file types with Ngnix. I plan to then import two JS files from that folder into my index.html like so :

JavaScript

The problem is, I am getting a 404 Not Found error :

JavaScript

Below is my nginx.conf file.

JavaScript

Any help would be appreciated.

Advertisement

Answer

I figured out my problem. I failed to mention that I am using Docker as well and had to first move my desired files to /usr/share/nginx/html/ within the Nginx docker container and then put that file location as the location for alias.

Advertisement