# Nginx on Windows: Problem with leading slash on root path (GetFileAttributesEx() fails because of wr

**URL:** <https://www.ruby-forum.com/t/nginx-on-windows-problem-with-leading-slash-on-root-path-getfileattributesex-fails-because-of-wr/185129>\
**Category:** NGINX\
**Created:** [March 14, 2010, 5:29pm UTC](https://www.ruby-forum.com/t/nginx-on-windows-problem-with-leading-slash-on-root-path-getfileattributesex-fails-because-of-wr/185129 "2010-03-14T17:29:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Vogt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@Alexander\_Vogt](https://www.ruby-forum.com/u/Alexander_Vogt)\
**Post date:** [March 14, 2010, 5:29pm UTC](https://www.ruby-forum.com/t/nginx-on-windows-problem-with-leading-slash-on-root-path-getfileattributesex-fails-because-of-wr/185129/1 "2010-03-14T17:29:59Z")

</div>

Hi everyone,

i want to run nginx+php on windows for development purposes.

Im using the nginx-0.8.34 native build from the nginx download page (no  
cygwin ports). PHP and static files are served, although the following  
problems occur:

1. PHP is executed correctly, but it always sends a “500 internal server  
error” header
2. static files (for example css, js, etc) are sent with a “text/html”  
mime  
type, causing css not to be displayed on firefox

I digged a bit deeper, in the error.log i find a lot of lines like this:

58:42 [crit] 476#3664: \*4 GetFileAttributesEx()  
“/C:/creativespot/dslocal/rollout/public\_html/style\_combined/50b1a4103b08a80dd9bd0c2a706eaa17.css”  
failed (123: Die Syntax fÃ¼r den Dateinamen, Verzeichnisnamen oder die  
DatentrÃ¤gerbezeichnung ist falsch), client: 127.0.0.1, server:  
dogspot.local, request: “GET  
/style\_combined/50b1a4103b08a80dd9bd0c2a706eaa17.css HTTP/1.1”, host:  
“dogspot.local”

The error message says GetFileAttributesEx failed because of a wrong  
path/filename syntax. What seems to be the problem is the leading slash  
on  
the root directory: “/C:/creativespot/…” which should be  
“C:/creativespot/…”.

I believe that this might be the reason for not determining the correct  
mime-type (mime.types file is included correctly, i even tried to embed  
the  
whole “types {…}” section directly in nginx.conf, which didnt fix that  
issue). I also tried to use relative paths, absolute paths with drive  
letters, absolute paths without drive letters, but no difference,  
whatever i  
do, nginx always seems to prefix my path with a leading “/”.

How can i fix that? any help appreciated!

Here are some details on my server layout:

- nginx 0.8.34 native in c:\creativespot\dslocal\nginx

- web root should be c:\creativespot\dslocal\dsrollout\public\_html

- starting nginx from a batch script that does a “cd” to the nginx  
directory  
and a “start /b nginx.exe”

- nginx.conf:

http {

proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;

proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;

client\_max\_body\_size 6m;  
proxy\_buffer\_size 16k;  
proxy\_buffers 32 16k;

include c:/creativespot/dslocal/nginx/conf/mime.types;

include c:/creativespot/dslocal/nginx/conf/sites-available/\*;

}

the vhost conf:

server {  
listen 80 default\_server;

server\_name dogspot.local;

root c:/creativespot/dslocal/rollout/public\_html;

index index.php;

location /images {  
rewrite ^/images/(.\*) /images/dogspot/$1;  
break;  
}

location / {  
if (!-e /$request\_filename) {  
rewrite .\* /request\_router.php last;  
}

```
if ($uri = /) {
  rewrite .* /request_router.php last;
}

```

}

location ~ .php$ {  
include c:/creativespot/dslocal/nginx/conf/fastcgi\_params;

```
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME

```

c:/creativespot/dslocal/rollout/public\_html/request\_router.php;  
}

}
