I am trying to setup nginx web server for my web application.
Below are the URL's I want
www.example.com -----> /var/www/html
www.example.com/backend/ -----> /var/www/app/backend/www
www.example.com/frontend/ -----> /var/www/app/frontend/www
I am able to get /var/www/html to server me proper php file for example.com, but the other two I am not able to get them working.
My application is built on yii and I have used this as my base https://github.com/clevertech/YiiBackboneBoilerplate
There is a rewrite to remove index.php from the url
When I go to www.example.com/backend it takes me to the index.php but I have rewrites for url which make the link as such www.example.com/backend/site/login
and in the error logs show up like such
"/var/www/app/backend/www/site/login/index.php" is not found (2: No such file or directory), client: 114.143.183.171, server: example.com, request: "GET /backend/site/login/ HTTP/1.1", host: "example.com"
Below is the snippte of my conf
set $yii_bootstrap "index.php";
location / {
root /var/www/html/;
index $yii_bootstrap;
}
location /backend {
alias /var/www/app/backend/www;
index $yii_bootstrap;
}
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
# connect to a unix domain-socket:
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
# This file is present on Debian systems..
include fastcgi_params;
}
Please help me resolve this issue? I have tried to understand but cant find where I am wrong.