Welcome! Log In Create A New Profile

Advanced

Re: root and alias with php5-fpm

Kristofer Pettijohn
September 07, 2015 12:50PM
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@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@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

root and alias with php5-fpm

Kristofer Pettijohn September 07, 2015 12:24PM

Re: root and alias with php5-fpm

Kristofer Pettijohn September 07, 2015 12:50PM

Re: root and alias with php5-fpm

Francis Daly September 07, 2015 05:26PM

Re: root and alias with php5-fpm

Kristofer Pettijohn September 07, 2015 07:50PM

Re: root and alias with php5-fpm

Francis Daly September 08, 2015 03:46AM

Re: root and alias with php5-fpm

Kristofer Pettijohn September 08, 2015 10:24AM

Re: root and alias with php5-fpm

Francis Daly September 09, 2015 03:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 214
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready