0

I have set up Nginx on Ubuntu server 14.04 I want to configure a very simple server block that listens for /app path and redirects traffic to a running nodejs instance locally.

I have done that with proxy_pass and other proxy settings.

My problem is that all the static content (img,js etc) from the node app are trying to be served from /var/www/html which is the root objective defined in the default site configuration created upon Nginx installation! I have deleted the symbolic link from enabled-sites folder and even removed the default file from the sites-available folder with no result! Even so the root path is serving the default Nginx welcome page which is defined in this site configuration and nowhere else!

Are Nginx defaults defined anywhere else? As long as I create a simple site configuration as simple as server {} welcome page and static content are served as defined in the default file which I have deleted!!! How can I fix that?

UPDATE: I have found out that the default file being served, is not from /var/www/html as I thought that was defined in sites-available/default. Instead it is being served from /usr/share/nginx/html..... but this path is not mentioned anywhere inside the config? How does it get it from there?

2
  • That location is the real default, i.e. compiled in. Anything is config files is really not default if you think about it, it's being overwritten by the config... Back to your question: is /app now correctly being passed to your nodejs instance? What urls are not, and how should they be handled? (Update your question, don't just add a comment.)
    – wurtel
    Feb 27, 2015 at 10:47
  • I understand now. I thought it was coming from a configuration file. So I guess that unless you specify some other option, the compiled ones are used by default.... Right? If so please add it as an answer so I can mark it
    – mitsos1os
    Feb 27, 2015 at 14:38

1 Answer 1

1

The /usr/share/nginx/html directory is compiled in as the builtin default document root.

You can override the builtin defaults using config files, but the values in there are perhaps default values for the package (as in the distribution package you installed nginx with), but not necessarily the same as the default compiled in values.

You can check that the compile time values were by running nginx -V.

Note that the way nginx is built it will basically work without any configuration, whereas apache needs config files to tell it what to do as apache basically does not have anything compiled in as default (except perhaps the location of the config file). Perhaps that is where the confusion arose.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .