Welcome! Log In Create A New Profile

Advanced

index.php works, / does not

Posted by peterkirn 
index.php works, / does not
June 30, 2012 05:29AM
I'm having difficulty passing the root of a test subdomain to index.php on a new install.

fastcgi_index is pointed at index.php. If I load domain.tld/index.php directly (or any other URL), all is well. If I go to domain.tld/ nginx serves a download rather than executing index.php.

I think it's perhaps easiest to post the whole configuration. Normally, this works for me, so I'm unsure of what the variable may be? (I had been using WordPress, though, and this is the first time I've done rules for Vanilla, so perhaps I'm muddled and did something wrong with my new nginx rules that I'm not spotting!)

Thanks!


server {
listen 80;
server_name createdigitalnoise.com;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;

root /home/cdnoise/vanilla;
index index.php index.html;

location / {

fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
rewrite ^(.+)$ /index.php$1 last;

if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
}

location ~ \.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;

set $script $uri;
set $path_info "";

if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}

fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;
}
}
}
Re: index.php works, / does not
June 30, 2012 08:11AM
Never mind; I'll close this. I did further tests and it seems odd rules in Vanilla are screwing up my nginx directives -- and my tests to rule that out initially didn't work because Google Chrome was doing some strange caching. ;) (Note to anyone else - yes, you can't always count on Chrome in that regard whilst changing things!)

For anyone using nginx and Vanilla, highly endorse this article:
http://blog.bigdinosaur.org/vanilla-forum-on-nginx/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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