Understanding alias (used as rewrite)

Edho Arief me at myconan.net
Tue Jun 23 03:17:24 UTC 2015


On Tue, Jun 23, 2015 at 5:32 AM, E.B. <emailbuilder88 at yahoo.com> wrote:

>>
>> You're probably looking for this
>>
>> fastcgi_param SCRIPT_FILENAME /another/different/path/anotehrscript.php;
>
> Excellent point! Thanks you!
> However, what if the alias was NOT to a php file? Is using
> rewrite the only solution - alias not able to working? What
> is alias doing to cause 404?

This config works for me.

  location ~ ^/test {
    alias /data/public_html/somefile.php;
    include fastcgi.conf;
    fastcgi_pass 127.0.0.1:8900;
  }

Check what your error log says to find out why it returns 404.

Also the question mark you put will become part of file name php look
for (it'll look for 'file.php?' instead of 'file.php'.



More information about the nginx mailing list