Cannot change default root path

Igor Sysoev is at rambler-co.ru
Thu Feb 26 09:25:20 MSK 2009


On Wed, Feb 25, 2009 at 02:12:30PM -0800, Merlin wrote:

> 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;

For this case it's better to use just "root":

   location /funstuff {
      root  /home/me;

The "alias" is required if you need to replace location part.

>   }
> }
> 
> - Merlin
> 
> On Wed, Feb 25, 2009 at 1:21 PM, Yaax Yaax <lists at ruby-forum.com> 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 http://www.ruby-forum.com/.
> >
> >

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list