DirectoryIndex on nginx
August 20, 2009 12:19AM
Hi there,

I am new to Nginx. For Apache, you use .htaccess to do most of the tricks. For example, to specific an index file you can write the following into the .htaccess file.

DirectoryIndex index.php index.html index.jsp


Now if you have index.php, whenever you enter your domain (without any file included) will load up to your index.php - that's your default as setup by the htaccess.

For nginx, you don't use htaccess and instead you do most of the tricks under nignx conf or something like that. I am new to this so I am asking for help.


I removed index.html from my root. Now when I entered 192.168.106 (that's my locahost) I get 403 error forbbien. I can access to 192.168.106/config.php to check my php config file, or 192.168.106/index.php specifically to see "Hello world" from my index.php.

I want to do what apache does with htaccess while on nginx server. Please guides me through this. Thank you.
Re: DirectoryIndex on nginx
August 23, 2009 07:03AM
Withing the server { } just type in the following:

[code]
server {
index index.php;
}
[/code]

--------------------------------------------------------------------------------
//richard.fussenegger.info
//movlib.org
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 169
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready