Forum: NGINX Windows installation - setting root

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2107d4e4b544f904194507258a40cac1?d=identicon&s=25 John Moore (Guest)
on 2008-12-05 15:19
(Received via mailing list)
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
561c2fb6d0c72e0c7bc52b263c7d56c3?d=identicon&s=25 Merlin (Guest)
on 2008-12-05 20:52
(Received via mailing list)
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?
2107d4e4b544f904194507258a40cac1?d=identicon&s=25 John Moore (Guest)
on 2008-12-06 14:04
(Received via mailing list)
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
604e194b0b23280a5447a0f31c78ae0b?d=identicon&s=25 Dan Dascalescu (Guest)
on 2009-02-05 08:04
(Received via mailing list)
John Moore <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 Worthington'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
This topic is locked and can not be replied to.