Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm following the html5boilerplate nginx setup for the most part, but everything keeps breaking when I include expires.conf.

HTML5BP for Nginx setup:

I've changed only a few very minor things which I'll put below. When in include conf/expires.conf however everything returns 404.

As a sidenote, I don't think it's just HTML5BP either.. i also followed this guide and images also broke (under the heading for Nginx tip #5 static assets expire).

location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
    access_log        off;
    log_not_found     off;
    expires           360d;

I'm using nginx on a server behind an EC2 elastic load balancer.

Here is my /etc/nginx/sites-enabled/example.conf:

server {
    listen       80;
    server_name  localhost;

    location / {
        root   /var/www/html/;
        index  index.html index.htm;

    # Specify a charset
    charset utf-8;

    # Custom 404 page
    error_page 404 /404.html;

    include conf/base.conf;

One odd thing i noticed is that if i check errors.log it has this..

2013/03/25 04:38:45 [error] 17920#0: *1 open() "/usr/share/nginx/html/index.html" failed (2: No such file or directory)

Yet I changed the directory away from /usr/share/nginx/html, so I have no idea why its looking there?

share|improve this question

The problem was I changed my nginx root path from /usr/share/nginx or whatever it is by default to /var/www/html/

That means the root command should have happened in my server directive instead of my location directive so that it trickles down. Because it couldnt see any root defined it was using the binary default

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.