alias

Igor Sysoev igor at sysoev.ru
Fri Dec 11 10:32:35 MSK 2009


On Fri, Dec 11, 2009 at 01:15:13AM -0200, Marcos Neves wrote:

> I want to create a special url that makes some scripts available to all
> sites.
> 
> All my sites are located at /var/www/<domain.name>/
> 
> And I have a directory at /var/www/_qi/ with my special scripts.
> 
> I want that on every domain, when access this:
> domainname.com/_qi/phpinfo.php
> 
> it should run the file /var/www/_qi/phpinfo.php
> 
> As you can see, php must still works.

server {
    server_name  domain1.name;

    root  /var/www/domain1.name;

    location / {
    }

    location ^~ /_qi/ {
        root  /var/www/;
        fastcgi_pass   ...;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ \.php$ {
        fastcgi_pass   ...;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

server {
    server_name  domain2.name;

    root  /var/www/domain2.name;

    location / {
    }

    location ^~ /_qi/ {
        root  /var/www/;
        fastcgi_pass   ...;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ \.php$ {
        fastcgi_pass   ...;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}


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



More information about the nginx mailing list