# How to add a new directory under domain root?

**URL:** <https://www.ruby-forum.com/t/how-to-add-a-new-directory-under-domain-root/215314>\
**Category:** NGINX\
**Created:** [December 30, 2011, 12:46am UTC](https://www.ruby-forum.com/t/how-to-add-a-new-directory-under-domain-root/215314 "2011-12-30T00:46:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [December 30, 2011, 12:46am UTC](https://www.ruby-forum.com/t/how-to-add-a-new-directory-under-domain-root/215314/1 "2011-12-30T00:46:39Z")

</div>

Hello

I have a folder titled images folder in www root, intending to hold some  
images.

However, the folder is not visible when I try to look at images in it.

e.g.

[http://192.168.1.68/imagesfolder/](http://192.168.1.68/imagesfolder/)  
– gives a 404 Not Found error.

![myimage](http://192.168.1.68/imagesfolder/button-closed.png)  
– gives a broken image

The root (/usr/share/nginx/www) works perfectly though. Even the image  
shows up clearly if I put it in the root folder.

Do you know how I can fix this/ I have been changing the folder name  
and permissions to no avail. I was kind of groping in the dark with the  
locations directive too – I have no much knowledge in that area. I  
have pasted the configuration file below. I added the last location  
directive shown and then reloaded the configuration file and restarted  
nginx as shown. Any guidance is much appreciated.

sudo /etc/init.d/nginx reload  
sudo /etc/init.d/nginx restart

Thanks!  
Fouwaaz

=====================================================

user www-data;  
worker\_processes 5;  
pid /var/run/nginx.pid;

events {  
worker\_connections 768;

# multi\_accept on;

}

http {

## 

# Basic Settings

## 

sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;  
keepalive\_timeout 2;  
types\_hash\_max\_size 2048;

# server\_tokens off;

# server\_names\_hash\_bucket\_size 64;

# server\_name\_in\_redirect off;

include /etc/nginx/mime.types;  
default\_type application/octet-stream;

## 

# Logging Settings

## 

access\_log /var/log/nginx/access.log;  
error\_log /var/log/nginx/error.log;

## 

# Gzip Settings

## 

gzip on;  
gzip\_disable “msie6”;

# gzip\_vary on;

# gzip\_proxied any;

# gzip\_comp\_level 6;

# gzip\_buffers 16 8k;

# gzip\_http\_version 1.1;

# gzip\_types text/plain text/css application/json

application/x-javascript text/xml application/xml application/xml+rss  
text/javascript;

## 

# If HTTPS, then set a variable so it can be passed along.

## 

map $scheme $server\_https {  
default off;  
https on;  
}

## 

# Virtual Host Configs

## 

include /etc/nginx/conf.d/_.conf;  
include /etc/nginx/sites-enabled/_;

server {  
location ~ .php$ {  
include /etc/nginx/fastcgi\_params;  
if ($uri !~ “^/images/”) {  
fastcgi\_pass 127.0.0.1:9000;  
}

}  
location ^~ /imagesfolder {  
autoindex on;  
}

}

}

#mail {

# # See sample authentication script at:

# # [Using a PHP Script on an Apache Server as the IMAP Auth Backend | NGINX](http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript)

# 

# # auth\_http localhost/auth.php;

# # pop3\_capabilities “TOP” “USER”;

# # imap\_capabilities “IMAP4rev1” “UIDPLUS”;

# 

# server {

# listen localhost:110;

# protocol pop3;

# proxy on;

# }

# 

# server {

# listen localhost:143;

# protocol imap;

# proxy on;

# }

#}

Posted at Nginx Forum:

> **[How to add a new directory under domain root?](https://forum.nginx.org/read.php?2,220689,220689#msg-220689)**
>
> Hello I have a folder titled images folder in www root, intending to hold some images. However, the folder is not visible when I try to look at images in it. e.g. http://192.168.1.68/imagesfolder/ -- gives a 404 Not Found error.

---

<div class="post-metadata">

**Author:** ![mfouwaaz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9a140/32.png) [@mfouwaaz](https://www.ruby-forum.com/u/mfouwaaz)\
**Post date:** [January 1, 2012, 9:33pm UTC](https://www.ruby-forum.com/t/how-to-add-a-new-directory-under-domain-root/215314/2 "2012-01-01T21:33:34Z")

</div>

Just for the record, things seem to be back to normal when I change the  
folder name from images to img. That`s how I resolved this issue –  
until the nginx or css Gods deem otherwise (I tend to lean toward the  
former though).

Best wishes for a New Year filled with Peace, Prosperity and Happiness!

Posted at Nginx Forum:

> **[Re: How to add a new directory under domain root?](https://forum.nginx.org/read.php?2,220689,220725#msg-220725)**
>
> Hello I have a folder titled images folder in www root, intending to hold some images. However, the folder is not visible when I try to look at images in it. e.g. http://192.168.1.68/imagesfolder/ -- gives a 404 Not Found error.
