I am trying to set up roundcube / phpldapadmin / ... with nginx on relative urls, e.g.:
example.com/roundcube
example.com/phpldapadmin
Firs
The location and alias should both have a trailing / or neither have a trailing /. But in your case, you should be using root instead of alias for both location blocks.
location /roundcube {
root /var/www;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
location /phpmyadmin {
root /usr/share;
index index.php index.html index.htm;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
The fastcgi_index will not do anything in a location that only matches .php (see this document).
The SCRIPT_FILENAME parameter is needed in both blocks (or neither if it is already in /etc/nginx/fastcgi_params).
Alternatively you can try to write at the top of nginx.conf >> user username
Since I am using AWS Linux EC2 instance I wrote
user ec2-user;
instead of
user nginx;
This solves the problem by giving all the required permissions