# Windows installation - setting root

**URL:** <https://www.ruby-forum.com/t/windows-installation-setting-root/154953>\
**Category:** NGINX\
**Created:** [December 5, 2008, 3:19pm UTC](https://www.ruby-forum.com/t/windows-installation-setting-root/154953 "2008-12-05T15:19:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [December 5, 2008, 3:19pm UTC](https://www.ruby-forum.com/t/windows-installation-setting-root/154953/1 "2008-12-05T15:19:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [December 5, 2008, 8:52pm UTC](https://www.ruby-forum.com/t/windows-installation-setting-root/154953/2 "2008-12-05T20:52:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [December 6, 2008, 2:04pm UTC](https://www.ruby-forum.com/t/windows-installation-setting-root/154953/3 "2008-12-06T14:04:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [February 5, 2009, 8:04am UTC](https://www.ruby-forum.com/t/windows-installation-setting-root/154953/4 "2009-02-05T08:04:13Z")

</div>

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
