Welcome! Log In Create A New Profile


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

Alexander Vogt
March 14, 2010 12:32PM
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()
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 on
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 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:

worker_processes 1; error_log
c:/creativespot/dslocal/nginx/logs/error.log; pid
c:/creativespot/dslocal/nginx/nginx.pid; 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


nginx mailing list
Subject Author Posted

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

Alexander Vogt March 14, 2010 12:32PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 97
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready