View Single Post
  #3  
Old 26th June 2013, 22:48
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 395
Thanks: 30
Thanked 58 Times in 50 Posts
Default

More and more questions...

So, now that PMA functions as expected, I am hoping to achieve the same with Roundcube webmail.

In theory, I should be able to use nearly the same configuration directives. The only difference between PMA and Roundcube is that the request directory and the filesystem directory share the same name (I chose "pma") for PMA, but for Roundcube, I want to use "/webmail" for the location and "roundcube" on the filesystem.

To better illustrate:

Code:
LOCATION -> FILESYSTEM PATH
------------------------------------
/pma -> /var/www/pma
/webmail -> /var/www/roundcube
My limited understanding of nginx dictates that the Roundcube case calls for the use of the alias directive, as opposed to the root directive.

So, I tried replacing "pma" with "webmail" in each location's first line, and replacing root /var/www/ with alias /var/www/roundcube/ within each location's body.

This didn't work. I receive a 404 when requesting the /webmail URL, with no errors logged (just standard 404s in the vhost's access.log).

I diddled with adding the regex capture groups to the end of the alias and such, but this didn't seem to change the behavior.

Here's where I gave-up:

Code:
location /webmail {
    alias /var/www/roundcube/;
    index index.php index.html index.htm;
    location ~ ^/webmail/(.+\.php)$ {
        try_files $uri =404;
        alias /var/www/roundcube/$1;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_param HTTPS on;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        # Using the below line instead of the above didn't seem to change anything.
        #fastcgi_param SCRIPT_FILENAME $request_filename;
        include /etc/nginx/fastcgi_params;
    }
    location ~* ^/webmail/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        alias /var/www/roundcube/$1;
    }
}
location /WEBMAIL {
    rewrite ^/* /webmail last;
}
Any help is much appreciated!

UPDATE: This is the kind of thing that makes one want to drink to excess. After searching the darkest corners of my brain, I remembered reading in the nginx Documentation, "Note that there is a longstanding bug that alias and try_files don't work together." So, I commented-out the try_files line and everything worked!

Last edited by cbj4074; 26th June 2013 at 22:51.
Reply With Quote