root and alias with php5-fpm
Kristofer Pettijohn
kristofer at cybernetik.net
Mon Sep 7 16:48:40 UTC 2015
Is this the issue I might be experiencing when I try to use the alias directive?
https://trac.nginx.org/nginx/ticket/97
> On Sep 7, 2015, at 11:23 AM, Kristofer Pettijohn <kristofer at cybernetik.net> wrote:
>
> I am having a difficult time finding a solution for this.
>
> I have PHP applications that may be referenced to from several websites, either from root locations or sub locations.
>
> For example:
>
> server {
> server_name domain.com;
> location / {
> ... unrelated stuff ...
> }
> location /grant {
> root /apps/grant/;
> index index.php index.html;
> try_files $uri $uri/ /grant/index.php?$args;
>
> location ~ \.php$ {
> include fastcgi_params;
> fastcgi_pass unix:/local/sockets/grant.sock;
> }
> }
> }
>
> and then it may be somewhere else like this:
>
> server {
> server_name another-domain.com;
> location / {
> ... unrelated stuff ...
> }
> location /employ {
> root /apps/grant/;
> index index.php index.html;
> try_files $uri $uri/ /employ/index.php?$args;
>
> location ~ \.php$ {
> include fastcgi_params;
> fastcgi_pass unix:/local/sockets/grant.sock;
> }
> }
> }
>
> So the only two things different are the "location" and "try_files". However, I know that "root" will append the URI to the path, so it will try /apps/grant/grant/ and /apps/grant/employ/ when looking for files. When I use "alias", it seems that try_files tries looking for index.php in the context of "location /" on each.
>
> The only way I can seem to resolve this is by creating a symbolic link at /apps/grant/grant/ and /apps/grant/employ/ pointing back to /apps/rant/, which I do not want. I just want each location in each server to see /apps/grant/ as the root, and for try_files to process the index.php file in the base of that location last.
>
> I have Lua compiled in, so I'm not sure if there are any tricks I can do with that to get this to work. I'm not sure what I'm missing.
>
> Can someone provide some guidance?
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150907/4474a1a6/attachment.html>
More information about the nginx
mailing list