Help- can't see subdirectories for static content location

Jean-Philippe Moal skateinmars at skateinmars.net
Fri Mar 27 15:36:25 MSK 2009


Carlos a écrit :
> I got it!!!
> 
> I had misunderstood the location /media/ function.
> 
> I thought that /media/ was a virtual name for the root string.
> I see that in fact /media/ is a directory that must exist in the root.
> 

You can use alias if you don't want to create a media folder in your static
directory.

> What confused me was that in fact, trying and trying, I had created a media
> folder and copied one html file into it but I forgot about that. So, I
> thougth that I was seeing only that html from the /static/ dir while I was
> seeing the copy at /static/media/.
> 
> Anyway this silly thing has helped me to understand nginx and its
> configuration a little better.
> 
> Thank you and best wishes.
> 
> 
> 
> 2009/3/27 Igor Sysoev <is at rambler-co.ru>
> 
>> On Fri, Mar 27, 2009 at 09:01:57AM +0000, equalium wrote:
>>
>>> Hello, I'm setting up nginx to serve a django site. The django part goes
>> OK but
>>> I have a problem with my media directory. I'm using this:
>>>
>>> location /media/ {
>>>    root   /home/django/domains/myapp/static/;
>>> }
>>>
>>> ...
>>>
>>> The problem is that I can access that directory and any html file
>> directly
>>> inside but not other directories or images.
>> Probably, you have also something like this:
>>
>>    location ~ \.(gif|png|jpg|css|js)$ {
>>
>> You may delete it if it is not needed, or may disable regex tests for
>> /media/:
>>
>>    location ^~ /media/ {
>>
>>> For example, my directories are like this:
>>>
>>> ./domains
>>> ...myapp
>>> ......static
>>> .........CSS
>>> .........images
>>> .........js
>>> .........hello.html
>>> .........image.png
>>>
>>> I have the option "autoindex on;", so when I access:
>> http://mydomain/media/ I see:
>>> Index of /media/
>>> ../
>>> hello.html
>>>
>>> Does anybody know what can be wrong?
>> Do you see in the listing just index.html without image.png, etc. ?
>>
>>
>> --
>> Igor Sysoev
>> http://sysoev.ru/en/
>>
>>
> 






More information about the nginx mailing list