在Ubuntu的Nginx安装给500错误

我刚在Ubuntu 12.04 LTS上安装了nginx。 当我访问本地主机时,它给了我:

500内部服务器错误nginx / 1.2.3

error_log有以下内容

redirect或内部redirect周期内部redirect到“/index.html”,客户端:127.0.0.1,服务器:本地主机,请求:“GET / HTTP / 1.1”,主机:“本地主机”

这是默认的nginxconfiguration:nginx.conf有:

include /etc/nginx/sites-enabled/*; 

/ etc / nginx / sites-enabled / default有以下内容

  root /usr/share/nginx/www; index index.html index.htm; # Make site accessible from http://localhost/ server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ /index.html; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } 

Nginx将默认站点直接从www改为html。

root / usr / share / nginx / www;

应该改成

根/ usr / share / nginx / html;

这个简单的configuration你根本不需要位置块和try_files。