我正在尝试设置一个非常简单的nginxconfiguration来提供静态内容。 这是我的configuration设置。 每当我尝试访问一个不存在的文件而不是404时,我得到HTTP 500.请让我知道我在做什么错了?
2012/12/21 11:15:14 [error] 1906#0:* 41在内部redirect到“/index.html”时客户端:127.0.0.1, :“GET /favicon.ico HTTP / 1.1”,主机:“i.domain.com”
server { listen 127.0.0.1:81; ## listen for ipv4; this line is default and implied root /project/; index index.html index.htm; location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { access_log off; log_not_found off; expires 360d; } server_name i.domain.com; location / { try_files $uri $uri/ /index.html; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } }
看来你有两个问题。
当发出请求时,它通过try文件进程。 最后,它意识到index.html不存在,并继续返回404.要完成该任务,现在必须获取404.html并重新开始请求。 它检查$ url($ url被定义为“404.html”),然后$ url /,然后index.html再次进入无限循环。
当你进入inf循环时,这是一个内部错误。 因此,适当地错误500被服务。
您没有在/project目录中创buildindex.html文件