Can't make a simple configuration

Hi,

This will be an absolute beginner question. Sorry about that. What I
want to
do is, I want to serve all files under http://localhost/static from
/home/myname/public_html/static

My configuration regarding that part:

location ~ /static/* {
root /home/yasar/public_html/;
}

I have put index files just to test it in ~/public_html/static adming
folder
under static folder and css folder under admin folder and I can see all
of
index.html files. But when I try to get an css file there, I get this
error
(from error log):

2011/07/20 00:42:27 [error] 7749#0: *1 open()
“/etc/nginx/html/static/admin/css/ie.css” failed (2: No such file or
directory), client: 127.0.0.1, server: localhost, request: “GET
/static/admin/css/ie.css HTTP/1.1”, host: “localhost”

appereantly, my root directive doesn’t work some reason. Any help would
be
appriciated.

Yaar Arabac.

Hello!

The reason being that the asterisk “*” is irrelevant in the PCRE (Perl
Regex syntax) expression for what you intend it to do.

Try the following, instead (no regex):

location /static/ {
root /home/yasar/public_html;
}

Hope it helps,

Andrejs

Posted at Nginx Forum: