2

I just installed nginx on ubuntu 12.04 LTS. When i access localhost it gives me :

500 Internal Server Error nginx/1.2.3

error_log has following

rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"

This is default nginx configuration: nginx.conf has:

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

/etc/nginx/sites-enabled/default has following

    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
    }
3
  • Welcome to Server Fault. While we're pretty good sysadmins, we can neither read your mind nor your monitor. Please provide as much detail as possible when asking your questions. In this case, your nginx configuration would be necessary to figure out what's going on. Use the edit link to edit your question and provide the missing information. Aug 29, 2012 at 3:53
  • 1
    possible duplicate of Nginx 1.2.2: How to get try_files to work?
    – quanta
    Aug 29, 2012 at 5:00
  • I would post this as an answer, but I'm not sure it is: have you tried putting an index.html, even just a basic one, in the document root?
    – pjmorse
    Sep 18, 2012 at 1:45

2 Answers 2

4

Nginx changed the default site directly name from www to html.

root /usr/share/nginx/www;

Should be changed to

root /usr/share/nginx/html;

1
  • This worked for me as well. found in /etc/nginx/sites-enabled/default
    – Stephanie
    Oct 26, 2012 at 1:21
0

You don't need the location block and the try_files at all for this simple configuration.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .