Alias which works like in other web servers

Igor Sysoev is at rambler-co.ru
Sun Aug 5 14:11:08 MSD 2007


On Sun, Aug 05, 2007 at 10:41:50AM +0100, marc at corky.net wrote:

> Would it not be wise to create a type of alias that most people are 
> comfortable with (and think is logical, due to their previous experience 
> with other web servers) ?
> 
> It seems that such an alias would simplify configurations of this type, 
> which to me look pretty common and useful.

Well, how you will configure this in Apache or lighty ?

> Igor Sysoev wrote:
> >On Sat, Aug 04, 2007 at 10:04:10PM +0100, marc at corky.net wrote:
> >
> >  
> >>I already had this working like this.   But unfortunately every single 
> >>request, for any file (jpg, swf...etc) gets passed to fastcgi, too...
> >>    
> >
> >   location /blog/wp-admin/ {
> >       alias   /var/www/wordpress/wp-admin/;
> >       auth_basic "adm"; 
> >       auth_basic_user_file conf/nginx.user;
> >   }
> >
> >   location ~ ^/blog/wp-admin/.+\.php$ {
> >       auth_basic "adm"; 
> >       auth_basic_user_file conf/nginx.user;
> >
> >       rewrite   ^/blog(/.*)$        $1  break;
> >
> >       fastcgi_pass    ...
> >       fastcgi_param   SCRIPT_NAME   /var/www/wordpress$uri;
> >       ...
> >   }
> >
> >   location /blog/ {
> >       alias   /var/www/wordpress/;
> >   }
> >
> >   location ~ ^/blog/.+\.php$ {
> >       rewrite   ^/blog(/.*)$        $1  break;
> >
> >       fastcgi_pass    ...
> >       fastcgi_param   SCRIPT_NAME   /var/www/wordpress$uri;
> >       ...
> >   }
> >
> >  
> >>Igor Sysoev wrote:
> >>    
> >>>On Sat, Aug 04, 2007 at 10:21:11AM +0100, marc at corky.net wrote:
> >>>
> >>> 
> >>>      
> >>>>I need / to point to /var/www/site,  /blog to /var/www/wordpress, 
> >>>>/nagios to /var/www/nagios, /munin to /var/www/munin   the /munin, 
> >>>>/nagios and /blog/wp-admin dirs should be password protected using auth.
> >>>>
> >>>>All dirs except /munin and /nagios have PHP scripts in them that need 
> >>>>to be run.
> >>>>   
> >>>>        
> >>>  location / {
> >>>      root   /var/www/site;
> >>>
> >>>      fastcgi_pass    ...
> >>>      fastcgi_index   index.php;
> >>>      fastcgi_param   SCRIPT_NAME      
> >>>      $document_root$fastcgi_script_name;
> >>>      ...
> >>>  }
> >>>
> >>>  location /blog/ {
> >>>      alias   /var/www/wordpress/;
> >>>
> >>>      fastcgi_pass    ...
> >>>      fastcgi_param   SCRIPT_NAME      $request_filename;
> >>>      ...
> >>>  }
> >>>
> >>>  location /blog/wp-admin/ {
> >>>      alias   /var/www/wordpress/wp-admin/;
> >>>
> >>>      auth_basic "adm"; 
> >>>      auth_basic_user_file conf/nginx.user;
> >>>
> >>>      fastcgi_pass    ...
> >>>      fastcgi_param   SCRIPT_NAME      $request_filename;
> >>>      ...
> >>>  }
> >>>
> >>>  location /nagios/ {
> >>>      root   /var/www;
> >>>
> >>>      auth_basic "adm"; 
> >>>      auth_basic_user_file conf/nginx.user;
> >>>  }
> >>>
> >>>  location /munin/ {
> >>>      root   /var/www;
> >>>
> >>>      auth_basic "adm"; 
> >>>      auth_basic_user_file conf/nginx.user;
> >>>  }
> >>>
> >>>
> >>> 
> >>>      
> >>    
> >
> >  
> 
> 

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





More information about the nginx mailing list