Fresh install of nginx causes browser to download index.html instead of opening it

Posted by 010110110101 on Server Fault See other posts from Server Fault or by 010110110101
Published on 2013-06-30T00:16:22Z Indexed on 2013/06/30 4:22 UTC
Read the original article Hit count: 197

Filed under:
|

When I view this in Chrome, http://localhost:90 the file is downloaded instead of displayed in Chrome.

This question has been asked a lot of times on SO, but about index.php files. My problem is a plain jane HTML file, not a PHP file. That hasn't been asked yet. I was hoping the solution would be similar, but I haven't been able to figure it out.

Here's my example.com.conf:

server
{
    server_name localhost;
    listen 90;
    root /var/www/example.com/html
    index index.html

    location / {
        try_file $uri $uri/ =404;
    }
}

My index.html file contains only two words, no markup

Hello World

I think it's the mime.types. The mime.types file has the entry for html in it. This is a fresh nginx install.

nginx -t reports "test is successful"

© Server Fault or respective owner

Related posts about ubuntu

Related posts about nginx