Hi all,
I've got nginx set up and working with php5-fpm and modx.
The only issue I'm having is with getting friendly urls to work and wondered if anyone could spot the issue with my config.
server {
root /usr/share/nginx/html;
index index.php;
error_log /usr/share/nginx/html/error.log notice;
rewrite_log on;
location / {
try_files $uri $uri/ @modx;
}
location @modx {
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ \.php(.*)$ {
fastcgi_index index.php;
fastcgi_pass php5-fpm-sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
The error log shows the following when I hit a friendly url,
[notice] 4869#0: *1412 "^/(.*)$" matches "/modx-2.2.6-pl/another-page/", client: 89.145.217.142, server: , request: "GET /modx-2.2.6-pl/another-page/ HTTP/1.1", host: "ec2-54-246-50-76.eu-west-1.compute.amazonaws.com", referrer: "
http://ec2-54-246-50-76.eu-west-1.compute.amazonaws.com/modx-2.2.6-pl/"
[notice] 4869#0: *1412 rewritten data: "/index.php", args: "q=modx-2.2.6-pl/another-page/", client: 89.145.217.142, server: , request: "GET /modx-2.2.6-pl/another-page/ HTTP/1.1", host: "ec2-54-246-50-76.eu-west-1.compute.amazonaws.com", referrer: "
http://ec2-54-246-50-76.eu-west-1.compute.amazonaws.com/modx-2.2.6-pl/"
[error] 4869#0: *1412 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 89.145.217.142, server: , request: "GET /modx-2.2.6-pl/another-page/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.soc:", host: "ec2-54-246-50-76.eu-west-1.compute.amazonaws.com", referrer: "
http://ec2-54-246-50-76.eu-west-1.compute.amazonaws.com/modx-2.2.6-pl/"
I think it's something to do with SCRIPT_FILENAME but I can't work out what it is, I've tried setting it to $request_filename and that hasn't worked either
Any help would be most appreciated