One domain, two home directories

Igor Sysoev is at rambler-co.ru
Fri Jul 4 00:05:57 MSD 2008


On Thu, Jul 03, 2008 at 08:36:26PM +0200, Emers wrote:

> I have problem with handling two different home directories into one 
> domain. For example my domain is mydomain.net and it points to directory
> /home/emers/www/
> 
> [...]
>     server {
>         listen          80;
>         server_name     mydomain.net;
>         access_log      /var/log/www/access_log_emers combined;
>         error_log       /var/log/www/error_log_emers error;
>         root            /home/emers/www;
>         index           index.html index.htm index.php;
> 
>         location ~ /\.ht {
>             deny        all;
>         }
> 
>         location ~ .*\.php?$ {
>             include /etc/nginx/fastcgi.conf;
>             fastcgi_pass  unix:/tmp/fcgi.socket;
>             fastcgi_index index.php;
>         }
>     }
> [...]
> 
> There is another user account in /home/mail/atmailopen/ with .php and 
> .html files.
> 
> The question is how to alias mydomain.net/mail into 
> /home/mail/atmailopen directory? I tried to add location:
> 
>         location /mail {
>             alias       /home/poczta/atmailopen/;
>         }
> 
> inside server brackets (included above), then .php files produces "No 
> input file specified" message, .html files are showed property.

Probably, you need to add the location and rewrite URI to match root:

          location ~ ^/mail/.*\.php?$ {

              rewrite  ^/mail(.+)$   $1   break;

              root        /home/poczta/atmailopen/;
              include /etc/nginx/fastcgi.conf;
              fastcgi_pass  unix:/tmp/fcgi.socket;
              fastcgi_index index.php;
          }


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





More information about the nginx mailing list