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

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”
    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()
failed (123: Die Syntax für den Dateinamen, Verzeichnisnamen oder die
Datenträgerbezeichnung ist falsch), client:, server:
dogspot.local, request: “GET
/style_combined/50b1a4103b08a80dd9bd0c2a706eaa17.css HTTP/1.1”, host:

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

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
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
    and a “start /b nginx.exe”

  • nginx.conf:

    worker_processes 1; error_log
    c:/creativespot/dslocal/nginx/logs/error.log; pid
    c:/creativespot/dslocal/nginx/; events {
    worker_connections 1024;

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;

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_index index.php;
fastcgi_param  SCRIPT_FILENAME



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