Windows installation - setting root


#1

I’m trying out the Windows port, but don’t see much in the way of
documentation. How would one specify a Windows path in the nginx.conf
file? For example, if I wanted to specify my root directory, which is,
e.g. ‘C:\MyApp\webroot’, would I use forward or backward slashes, etc?

TIA


#2

Generally, you will want to always use forward slashes. I am 90% this
is
also the case with nginx on windows; however, I lack a windows machine
to
test on. Have you tried it both ways?


#3

Merlin wrote:

directory, which is, e.g. 'C:\MyApp\webroot', would I use forward
or backward slashes, etc?

TIA

You’re right about the forward slashes, but it turned out that was not
the root of the problem. It seems that the root directory has to be
within the nginx directory, as this is the error I get when I specify
‘c:/Shared/projects/testapp’ as the root:

2008/12/05 13:00:52 [error] 6376#0: *4 open()
“/cygdrive/c/nginx/c:/Shared/projects/testapp/index.htm” failed (2: No
such file or directory), client: 127.0.0.1, server: localhost, request:
“GET /index.htm HTTP/1.1”, host: “10.0.2.2”

I clearly cannot specify an absolute path, it must be relative to and
within the nginx directory. I hope I’m mistaken about this.

JM


#4

John M. <grails@…> writes:

You’re right about the forward slashes, but it turned out that was not
the root of the problem. It seems that the root directory has to be
within the nginx directory

Argh, I banged my head on the desk for an hour about this!

Indeed, nginx bases the root directory into the hardcoded path
/cygdrive/c/nginx/
even if you don’t have Cygwin installed (I use Kevin W.'s
port).

Someone please fix this, it’s extremely annoying.

I clearly cannot specify an absolute path, it must be relative to and
within the nginx directory. I hope I’m mistaken about this.

There is a workaround, though, to use relative directory paths:

location / {
    root   ../www;
}

This will get you the root directory set to c:\www, if nginx lives in
C:\nginx.

HTH,
Dan Dascalescu