Alias which works like in other web servers

Igor Sysoev is at rambler-co.ru
Sat Aug 4 15:15:14 MSD 2007


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