Stickers
Stickers

Reputation: 78676

Nginx change document root directory

I'm using the Windows setup file from Nginx For Windows

But It doesn't allow to change the install location, so it defaults to C:\nginx Is there a way to update the config file to change the root directory to D:\blabla?

Sample code from nginx.conf

server {
    listen       80;
    server_name  localhost;

    location / {
        root   html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

Upvotes: 3

Views: 18365

Answers (3)

Dirk Leuther
Dirk Leuther

Reputation: 103

I don't know howit was two years ago but with an current Version (1.13.9) you only need to set the root of your Server

server {
    listen       80;
    server_name  localhost;

    location / {
        root   D:\blabla;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   D:\blabla;
    }
}

Upvotes: 2

itpp13
itpp13

Reputation: 454

root d:/path/whereever; will work without issues, but do use a proper windows version like the Butterfly or Caterpillar release and not those other crippled versions.

even a root '//192.168.2.5/mount/webdrive'; will work!

Upvotes: 2

VBart
VBart

Reputation: 15110

Use the -p parameter when you start nginx:

nginx -p "D:\blabla"

Upvotes: 5

Related Questions