Struggling with configuration
Alan Chandler
alan at chandlerfamily.org.uk
Fri May 9 06:30:17 UTC 2014
On 08/05/14 20:16, Alan Chandler wrote:
> Hi
>
> I am porting some stuff that I had working under Apache to now run
> under Nginx and I have a particular case that I don't know how to deal
> with.
>
> I have a physical directory structure like this
>
> dev/
> dev/myapp/
> dev/myapp/web/
>
> in this directory is an index.php file with the following early in its
> processing
> require_once($_SERVER['DOCUMENT_ROOT'].'/forum/SSI.php');
>
> dev/test-base/
> dev/test-base/forum/
>
> In this directory is an smf forum, and there is an SSI.php file in here
>
> my nginx configuration for this
>
> ...
> location /myapp {
> alias /home/alan/dev/myapp/web;
> try_files $uri /myapp/index.php;
> location ~* ^/myapp/(.+\.php)$ {
> fastcgi_pass unix:/var/run/php5-fpm-alan.sock;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
> include /etc/nginx/fastcgi_params;
> }
>
> }
> include php.conf
> ...
I eventually found a solution. Whether it is the right one I don't
know, but I have to redefine document root after I have included the
common fastcgi_params file.
location = /myapp {
rewrite ^ /myapp/ permanent;
}
location /myapp/ {
alias /home/alan/dev/myapp/web/;
index index.php;
}
location ~ ^/myapp/(.*\.php)$ {
alias /home/alan/dev/myapp/web/$1;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /home/alan/dev/test-base;
fastcgi_index index.php;
# fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm-alan.sock;
}
--
Alan Chandler
http://www.chandlerfamily.org.uk
More information about the nginx
mailing list