Basic question...

Ray gunblad3 at gmail.com
Sat May 22 21:30:28 MSD 2010


Perhaps placing the root and index directives one level higher (i.e.
within the server block) instead of at location / would be better.
Just customise the individual locations within the server.

server {
    ...
    ...
    root   /var/www/localhost/htdocs;
    index  index.html index.htm;

    location / {
        allow all;
    }

    ...
    ...
}


Ray.


On Sat, May 22, 2010 at 2:04 PM, Igor Sysoev <igor at sysoev.ru> wrote:
> On Sat, May 22, 2010 at 01:56:23AM -0400, gyan wrote:
>
>> Hello,
>>
>> I'm new to Nginx and I have a basic problem.  In short my "index.htm" isn't dynamically loading on any sub-directories other than root.
>>
>> For example, "http://www.mydomain.com/" will load the index.htm page just fine.  However, "http://www.mydomain.com/subdirectory/" will not load
>> the associated index.htm.  I have to manually specify ".../index.htm" within the URL for the page to load.  This can't be right/normal.
>>
>> My nginx.conf has this within the server declaration:
>>
>>               location / {
>>                       root   /var/www/localhost/htdocs;
>>                       index  index.html index.htm;
>>                       allow all;
>>               }
>>
>>               location ~* ^.+\.(jpg|jpeg|gif)$ {
>>                       root         /var/www/localhost/htdocs;
>>                       access_log   off;
>>                       expires      30d;
>>               }
>>
>> What am I missing?  This has become a show-stopper for my project so your help is *very* much appreciated!
>
> Do you have other locations ?
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



More information about the nginx mailing list