$fastcgi_script_name set incorrectly with alias directive

Michael Shadle mike503 at gmail.com
Sun Aug 28 20:47:01 UTC 2011


Alias does not change document root so that variable is going to be whatever the document root is. Not what the alias is

On Aug 28, 2011, at 12:57 PM, Dick Middleton <dick at fouter.net> wrote:

> Hi,
> 
>    I having trouble getting alias directive to work as I would expect.  One
> thing I find is that the location part of the request is not being dropped in
> the $fastcgi_script_name.
> 
> Here's my location block
> 
>       location /mydnsadmin {
>          alias /var/www/lingbrae.ssl/usr;
>          index mydns.php;
>          include includes/php-alt.inc;
>       }
> 
> I initially set the SCRIPT_FILENAME to $request_filename which is computed
> correctly but later I reset it to $document_root$fastcgi_script_name
> but is incorrect.
> 
> Here's the debug:
> ...
> *840 http script copy: "SCRIPT_FILENAME"
> *840 http script var: "/var/www/lingbrae.ssl/usr/mydns.php" <--- this is
> $request_filename
> *840 fastcgi param: "SCRIPT_FILENAME: /var/www/lingbrae.ssl/usr/mydns.php"
> <--correct
> *840 http script copy: "SCRIPT_NAME"
> *840 http script var: "/mydnsadmin/mydns.php"
> *840 fastcgi param: "SCRIPT_NAME: /mydnsadmin/mydns.php"
> *840 http script copy: "REQUEST_URI"
> *840 http script var: "/mydnsadmin/"
> *840 fastcgi param: "REQUEST_URI: /mydnsadmin/"
> *840 http script copy: "DOCUMENT_URI"
> *840 http script var: "/mydnsadmin/mydns.php"
> *840 fastcgi param: "DOCUMENT_URI: /mydnsadmin/mydns.php"
> *840 http script copy: "DOCUMENT_ROOT"
> *840 http script var: "/var/www/lingbrae.ssl/usr"
> *840 fastcgi param: "DOCUMENT_ROOT: /var/www/lingbrae.ssl/usr"
> ....
> *840 fastcgi param: "REDIRECT_STATUS: 200"
> *840 http script copy: "SCRIPT_FILENAME"
> *840 http script var: "/var/www/lingbrae.ssl/usr"  <-- This is $document_root
> *840 http script var: "/mydnsadmin/mydns.php" <--- this is
> $fastcgi_script_name  (notice location is not stripped)
> *840 fastcgi param: "SCRIPT_FILENAME:
> /var/www/lingbrae.ssl/usr/mydnsadmin/mydns.php"  <--- incorrect
> 
> 
> Am I supposed to set the fastcgi params differently if I use the alias
> directive or is this a problem with alias.
> 
> Dick
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list