Welcome! Log In Create A New Profile

Advanced

Is directive alias incompatible with module FastCGI?

August 17, 2010 09:15AM
Hello,

at first let me thank you for developing NginX! I use NginX 0.8.48, PHP 5.3.3 with inbuilt php-fpm version 0.6.5 on CentOS 5.5.

But there is one problem I have been trying to solve for hours without success: I want that PHP only gets parsed in an "aliased" subfolder but not in the parent location. Is this even possible?

I tried to achieve my aim in several ways, including this one:

[code]
server
{
listen 80;
server_name subdomain.example.com;
root /var/www/example/html;
index index.html index.php;

# Igor's suggestion from June 2009: forum.nginx.org/read.php?2,3059,3060#msg-3060

location ~ /test/
{
alias /var/www/phpmyadmin/;
}

location ~ ^/test/(.+\.php)$
{
alias /var/www/phpmyadmin/$1;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
}

location ~* \.(css|js|jpg|jpeg|gif|png|cur|bmp)$
{
access_log off;
expires 60d;
}
}
[/code]

PHP should only get parsed in

[color=#0033CC]subdomain.example.com/test/[/color] == [color=#CC3300]/var/www/phpmyadmin/[/color]

but not in

[color=#0033CC]subdomain.example.com/[/color] == [color=#CC3300]/var/www/example/html/[/color]

because another person has access to [color=#CC3300]/var/www/example/html/[/color] via chrooted SFTP, too.

Unfortunately, index.php in [color=#0033CC]subdomain.example.com/test/[/color] (at the moment a simple [color=#999999]<?php phpinfo(); ?>[/color]) doesn't get parsed but is provided for download by Chromium, while Opera shows the source code of the PHP file.

I also tried to nest "[i]location[/i]" directives and to work with "[i]if[/i]", but that didn't work either. For example:

[code]
location ~* /test/
{
alias /var/www/phpmyadmin/;

if ($uri ~ "\.php$")
{
fastcgi_pass 127.0.0.1:9000;
}
}
[/code]

I know that I could simply use a different subdomain for phpmyadmin, but I wonder if it's possible to use FastCGI / PHP together with the [i]alias[/i] directive.

Any help is appreciated, and if you'd like to see my complete config files, just let me know.

Kind greetings from Austria!
Wolfgang
Subject Author Posted

Is directive alias incompatible with module FastCGI?

IPB_Refugee August 17, 2010 09:15AM

Re: Is directive alias incompatible with module FastCGI?

IPB_Refugee August 27, 2010 08:27PM

Re: Is directive alias incompatible with module FastCGI?

edogawaconan August 28, 2010 12:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 286
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