I have nginx setup with an alias and am trying to do a rewrite rule with try_files. The problem is that it's preprending the document root and not finding the file. Configuration:
server {
listen 80;
server_name mysite.com;
root /var/www/default;
index index.html index.htm index.php;
location /coolapp {
alias /home/myhome/coolapp/www/;
index index.php;
try_files $uri $uri/ /home/myhome/coolapp/www/index.php?url=$uri&$args;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
}
And in the nginx error log:
[error] 21903#0: *2 open() "/var/www/default/home/myhome/coolapp/www/index.php" failed (2: No such file or directory) ...
Why is it prepending the root in try_files? I want the alias treated as its own root. What am I doing wrong here?