Nginx Cache Control打破了工作path

我正在关注大部分的html5boilerplate nginx设置,但是当我包含expires.conf时,所有的事情都一直在expires.conf

Nginx的HTML5BP设置: https : //github.com/h5bp/server-configs/tree/master/nginx

我只改变了一些我将在下面提到的小事情。 当在包含conf/expires.conf但是一切都返回404。

作为一个旁注,我不认为这只是HTML5BP ..我也按照这个指南 ,图像也打破了(在标题为Nginx提示#5静态资产到期)。

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

我在EC2弹性负载平衡器后面的服务器上使用nginx。

这是我的/etc/nginx/sites-enabled/example.conf:

 server { listen 80; server_name localhost; location / { root /var/www/html/example.com; index index.html index.htm; } # Specify a charset charset utf-8; # Custom 404 page error_page 404 /404.html; include conf/base.conf; } 

我注意到一个奇怪的是,如果我检查errors.log它有这个..

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

然而,我把目录从/ usr / share / nginx / html改变了,所以我不知道为什么它在那里?

问题是我改变了我的nginx根path从/ usr / share / nginx或者默认是/var/www/html/site.com

这意味着根命令应该发生在我的服务器指令,而不是我的位置指令,以便它慢慢下降。 因为它看不到任何定义的根,所以它使用二进制默认值

http://docs.ngx.cc/en/latest/topics/tutorials/config_pitfalls.html