Cannot change default root path

Merlin merlin at
Thu Feb 26 01:12:30 MSK 2009

You can do one of two things, both quite straight forward.  First, you can
build it with the --prefix set to something other than /usr/local/nginx or
you can supply a full-path with your configurations "root" directive.

You should have in your config somewhere a line like this:

root html;

Changing it like this should help:

root /var/www;

Of course you should replace /var/www with the proper root.  Also, for
sub-locations that need a separate root, you may find the "alias" directive
useful, like so:

server {
  listen 80;
  root /var/www;
  location /funstuff {
    alias /home/me/funstuff;

- Merlin

On Wed, Feb 25, 2009 at 1:21 PM, Yaax Yaax <lists at> wrote:

> I am new user of nginx, I installed it as replace of apache on cpanel
> server for one very busy site.
> I installed it to default folder /usr/local/nginx and setup it working
> with php fastcgi spawn, but it only works from nginx default root i.e.
> only from /usr/local/nginx/html
> I need its root to be changed for different vhosts paths like
> /home/user/public_html but look like all my commands like root
> /home/user/public_html; are some why ignored by nginx and it is always
> trying to run files from /usr/local/nginx/html
> I checked in error log - and there are no errors displayed - only in
> access log I see message that file not found 404 error.
> Can anyone help me with this basic setup?
> --
> Posted via
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list