Alias which works like in other web servers

Igor Sysoev is at rambler-co.ru
Fri Aug 3 21:34:38 MSD 2007


On Fri, Aug 03, 2007 at 05:16:06PM +0100, marc at corky.net wrote:

> Hi Igor,
> 
> I need mappings of complete directories as each directory contains many 
> php scripts and these scripts may be added/removed with future versions.

Could you describe all mappings that you currently need ?
I show you examples and you will may use them in future.

> Igor Sysoev wrote:
> >On Fri, Aug 03, 2007 at 04:57:07PM +0100, marc at corky.net wrote:
> >
> >  
> >>Hi Igor,
> >>
> >>Thanks for your quick reply.
> >>
> >>I tried location ^~ /blog but that produced a similar result, php-fcgi 
> >>returned 'No input file specified' as it was not able to open the path 
> >>provided to it by nginx.
> >>
> >>I also have the following block in order to force http authentication on 
> >>the /blog/wp-admin directory:
> >>
> >>location /blog/wp-admin {
> >>      alias   /var/www/wordpress/wp-admin;
> >>
> >>      auth_basic "adm"; 
> >>      auth_basic_user_file conf/nginx.user;
> >>           
> >>      rewrite ^.+?(/.*\.php)$ $1 break;
> >>}  
> >>
> >>Is there a way to put the auth stuff into the same /blog location ?
> >>
> >>I would very much want to have a few "true" Aliases in my config rather 
> >>than relying on symlinks, which is not really the clean/correct way to 
> >>do this IMHO.  Let's just say that for the sake of argument I need the 
> >>following aliases for the same vhost:  /blog /munin /nagios -- all of 
> >>which point to folders that are outside the document root of that 
> >>vhost.   I would also like to password protect each of these aliases.
> >>    
> >
> >Could you describe all mappings that you need ? i.e.:
> >
> >/blogs/dir/some.php -> //var/www/wordpress/some.php
> >etc.
> >
> >  
> >>Igor Sysoev wrote:
> >>    
> >>>On Fri, Aug 03, 2007 at 11:18:51AM +0100, Just Marc wrote:
> >>>
> >>> 
> >>>      
> >>>>I have a website and a wordpress blog under /blog/   The blog scripts 
> >>>>are sitting in a different directory, this is the conf:
> >>>>
> >>>>server {
> >>>> listen x.x.x.x;
> >>>> root   /var/www/site/;
> >>>>
> >>>> location /blog {
> >>>>     alias   /var/www/wordpress;
> >>>>
> >>>>     rewrite ^.+?(/.*\.php)$ $1 last;
> >>>>     rewrite ^ /index.php last;
> >>>> }
> >>>>
> >>>> location / {
> >>>>     rewrite '^/([^\.]*)\.html$'  /index.php?p=$1 last;
> >>>> }
> >>>>
> >>>> location ~ .php$ {
> >>>>     fastcgi_pass   10.0.0.1:1026;
> >>>>     fastcgi_index  index.php;
> >>>>     include        conf/fastcgi.conf;
> >>>> }
> >>>>
> >>>>With this conf, a request to: /blog/wp-login.php is processed by the 
> >>>>php location resulting in a bad URL (nginx tries to open: 
> >>>>/var/www/site/blog/wp-login.php).
> >>>>   
> >>>>        
> >>>Could you describe all mappings that you need ?
> >>>
> >>>
> >>> 
> >>>      
> >>    
> >
> >  
> 
> 

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





More information about the nginx mailing list