change the root directory in nginx

Francis Daly francis at
Thu Aug 2 18:02:18 UTC 2012

On Wed, Aug 01, 2012 at 05:09:39PM -0400, sayres wrote:

> Can you explain by example???

In your current config file, add

        root   /usr/share/nginx/html;

immediately after

server {

and delete the other four mentions of

        root   /usr/share/nginx/html;

that are inside different location{} blocks.

Your server should be effectively the same as it was

To change to a new root directory, change the one line that you added.

Francis Daly        francis at

More information about the nginx mailing list