Welcome! Log In Create A New Profile

Advanced

Re: subdirs without trailing slash

July 19, 2009 07:04AM
On Sat, Jul 18, 2009 at 11:33:14PM +0100, Dick Middleton wrote:

> I want to make the following equivalent:
>
> http://example.com/mail/index.php
> http://example.com/mail/
> http://example.com/mail
>
> The first two work OK but the last one I can't get to work. With the
> following it gives 404 error in the logs but the browser says "No input
> file specified." :
>
> location ~* ^/(web)?mail/.+\.(jpg|jpeg|gif|css|png|js|ico|html)$ {
> root /var/www;
> }
>
> location ~ ^/(web)?mail {
> root /var/www;
> index index.php;
> fastcgi_index index.php;
> include my_fastcgi_params;
> fastcgi_pass localhost:8888;
> }
>
> I've tried all sorts of variations of this including trying to rewrite the
> full uri in the last case.
>
> The my_fastcgi_params include
>
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> fastcgi_param SCRIPT_NAME $fastcgi_script_name;
>
> What is the recommended way to configure this?

If you set

location /mail/ {
fastcgi_pass localhost:8888;
...
}

and request "/mail" then nginx will return external redirect to "/mail/".

If you do not want the redirect, then

location = /mail {
fastcgi_pass localhost:8888;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT_NAME /index.php;
root /var/www;
}

location /mail/ {
fastcgi_pass localhost:8888;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
root /var/www;
}


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

subdirs without trailing slash

Dick Middleton July 18, 2009 06:33PM

Re: subdirs without trailing slash

Igor Sysoev July 19, 2009 07:04AM

Re: subdirs without trailing slash

Dick Middleton July 19, 2009 02:18PM

Re: subdirs without trailing slash

purabdk August 13, 2009 06:05AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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