Nginx alias vs Roundcube

When you install Roundcube from a distribution package (for example a .deb package on Ubuntu) the package installs files under /usr/share/roundcube/ If you want to serve Roudncube from a different URI than /roundcube/, then you have two options (maybe more):

  1. Create a softlink with the desired name in the document root folder to the roundcube folder
  2. Use the alias directive of Nginx

The problem with the second option is that the default fastcgi.conf Nginx config will create the wrong SCRIPT_FILENAME value, thus PHP will not find the PHP file. The solutions is to overwrite this parameter value with the correct one:

location /mail/ {
  alias /usr/share/roundcube/;
  try_files $uri $uri/ /index.php?$args;
  location ~ .php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    fastcgi_pass unix:/run/php/php-fpm.sock;
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.