nginx root file – index.php

user185371 asked:

i’m setting up an webserver based on nginx and php-fpm. All is ok but my domain opens just directory on – it should open index.php as i got this in my config:

location / {
    autoindex  on;
    try_files $uri $uri/ /index.php;

It should open index.php when typing – but it dont. How i can set root file – index.php index.html index.htm?

My answer:

Your server block needs to contain the index directive.

server {
    index index.php;

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.