Default page in NGINX

April 11, 2014 12.9k views
Hi, I have install a new LEMP server by following the instructions here https://digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04 The installation was successful by following the help guide. Issue: When I go to my domain example.com/index.php -- it works great When I go to my domain exmaple.com - It automatically download a file. I would like it to default to index.php or index.htm or index.html. How do I go about setting that up. Thank much for your help.
2 Answers
It download a page because in nginx.conf you have:
default_type application/octet-stream;

You can change it to
default_type text/html;
or something like that
More info: http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type

To have a default page
Use index index.php index.html;
More info: http://nginx.org/en/docs/http/ngx_http_index_module.html#index

works great :)

changing default_type application/octet-stream; to default_type text/html; in nginx.conf solved the issue.

Thanks much.
Have another answer? Share your knowledge.