A
A
Alexey Ukolov2014-12-12 11:33:39
Nginx
Alexey Ukolov, 2014-12-12 11:33:39

Why doesn't include work in nginx config?

I use https://github.com/h5bp/server-configs-nginx as a basis . I specified it in
the site config. I specified include h5bp/basic.conf;
it in basic.conf. include h5bp/location/cache-busting.conf;
But the files with the address example.com/css/main.1418295892.css are not located.
If you copy the contents of cache-busting.conf directly into the site config, everything starts working.
The following is in the logs:

2014/12/12 16:41:34 [error] 12858#0: *1 open() "/path/../assets/js/common.1418295892.js" failed (2: No such file or directory)

Please help me figure out the cause and fix it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Power, 2014-12-12
@alexey-m-ukolov

1. Check that the config contains no errors:
2. Show all the latest entries from error.log.
3. But in general, the problem seems to be that h5bp/location/expires.conf is included in h5bp/basic.conf, which already has

location ~* \.(?:css|js)$ {
  expires 1y;
  access_log off;
  add_header Cache-Control "public";
}

which works (locations defined by regexps are selected in the order they appear in the config).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question