September 20, 2016 01:06AM
Hi folks,

I am running php as fastcgi, replacing a working apache/mod_php setup.
I'm pretty close, but am not quite there.

The last bit I've got to get working is...

RewriteRule ^(.*)$ index.php [E=query:$1,L]

Which I understand to mean pass the request in a variable called query.

My (not working ) attempt is:

location / {
try_files $uri $uri/ @rewriteapp;
}

location @rewriteapp {
fastcgi_param query $request_uri;
rewrite ^(.*)$ /index.php last;
}

# Pass the php scripts to fastcgi server specified in upstream
declaration.
location ~ \.php(/|$) {
# Unmodified fastcgi_params from nginx distribution.
include fastcgi_params;
# Necessary for php.
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME
$realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /index.php$is_args$args;
fastcgi_pass backend;
}

Can anyone point out where I'm going wrong please?

Cheers,

Steve

--
Steve Holdoway BSc(Hons) MIITP
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa

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

rewrites...

GreenGecko September 20, 2016 01:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 88
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready