Welcome! Log In Create A New Profile

Advanced

Re: Rewrite and FastCGI.

Francis Daly
October 09, 2012 08:54AM
On Tue, Oct 09, 2012 at 02:03:40PM +0200, Thomas Martin wrote:

Hi there,

> # dir1
> location /dir1 {
> rewrite ^(.*) https://$host$1 permanent;
> }
>
> # php5-fpm
> location ~ \.(php|phtml)$ {
> include /etc/nginx/fastcgi_params;
> fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
> fastcgi_param SCRIPT_FILENAME
> /www/$fastcgi_script_name;
> }
> }

> The rewrite is working great for a html page (for example) but not for
> a php page.

One request is handled in one location.

You have

location /dir1 {}
location ~ \.(php|phtml)$ {}

Possibly what you want is

location ^~ /dir1 {}
location ~ \.(php|phtml)$ {}

or maybe

location /dir1 {}
location / {
location ~ \.(php|phtml)$ {}
}

See http://nginx.org/r/location for details.

(Possibly what you want is some other configuration: the important thing
to keep in mind is: for this request, which one location do you wish to
handle it? Then configure the locations accordingly.)

f
--
Francis Daly francis@daoine.org

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

Rewrite and FastCGI.

Thomas Martin October 09, 2012 08:04AM

Re: Rewrite and FastCGI.

Francis Daly October 09, 2012 08:54AM

Re: Rewrite and FastCGI.

Thomas Martin October 09, 2012 10:52AM

Re: Rewrite and FastCGI.

Francis Daly October 10, 2012 08:38AM

Re: Rewrite and FastCGI.

Thomas Martin October 11, 2012 03:50AM

Re: Rewrite and FastCGI.

Andre Jaenisch October 11, 2012 07:14AM

Re: Rewrite and FastCGI.

Thomas Martin October 11, 2012 07:22AM

Re: Rewrite and FastCGI.

tysonlee October 10, 2012 05:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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