How to add a new directory under domain root?


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

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

– gives a 404 Not Found error.

– 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



user www-data;
worker_processes 5;
pid /var/run/;

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

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/”) {

location ^~ /imagesfolder {
autoindex on;



#mail {

# See sample authentication script at:


# 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:,220689,220689#msg-220689

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:,220689,220725#msg-220725

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs