/
/
The error 404 while opening files with specific extension

The error 404 while opening files with specific extension

Symptoms

While opening existing files with specific extension, e.g. “.js”, the site that uses Node.js or Python returns the error 404.

Causes

The extension does not persist in the section location in the virtual host configuration file.

Solution

Via ispmanager 6

Navigate to configuration files of the site by selecting it at the section “Sites” and clicking on the button “Configuration files”.

 

Go to Nginx configuration file and add required extension to the string starting with location ~* ^.+\.. Use the symbol | as a separator.

 

Save changes by clicking on the button “Save and close”.

Via console

Connect to the server via SSH as the user "root".

Open the Nginx configuration file of the required site at /etc/nginx/vhosts/<user>/<site>.conf with text editor and add required extension to the string starting with location ~* ^.+\. Use the symbol | as a separator.

Save changes and reload the Nginx by executing following command:

service nginx restart