Search code examples
linuxnginxroundcube

How to setup nginx for roundcube in ispconfig server?


Hello im working on school project, I installed ISPConfig which configured nginx server and it works, now I want to enable roundcube webmail. Im running ubuntu so I used apt-get

apt-get install roundcube roundcube-plugins roundcube-plugins-extra

The wizard configured my MySQL database for roundcube and install roundcube web files to /usr/share/roundcube and in /var/lib/roundcube I have links to /usr/share/roundcube.

Now I need to tell nginx if someone request URL myispconfig.tld/webmail it open roundcube. But I'm not sure how to do this, maybe some alias or creating vhost ? I can configure apache but I'm new in nginx. I read roundcube documentation so next configuration I think I can handle. Thank you

edit: i tried add to /etc/nginx/sites-available/ispconfig.vhost

location  /webmail/ {
  alias  /usr/share/roundcube/;
}

but after nginx reload no changes :P


Solution

  • SOLVED: same configuration for squirrelmail works :-)

      location /roundcube {
              root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/roundcube/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_param   QUERY_STRING            $query_string;
                       fastcgi_param   REQUEST_METHOD          $request_method;
                       fastcgi_param   CONTENT_TYPE            $content_type;
                       fastcgi_param   CONTENT_LENGTH          $content_length;
    
                       fastcgi_param   SCRIPT_FILENAME         $request_filename;
                       fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
                       fastcgi_param   REQUEST_URI             $request_uri;
                       fastcgi_param   DOCUMENT_URI            $document_uri;
                       fastcgi_param   DOCUMENT_ROOT           $document_root;
                       fastcgi_param   SERVER_PROTOCOL         $server_protocol;
    
                       fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;
                       fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;
    
                       fastcgi_param   REMOTE_ADDR             $remote_addr;
                       fastcgi_param   REMOTE_PORT             $remote_port;
                       fastcgi_param   SERVER_ADDR             $server_addr;
                       fastcgi_param   SERVER_PORT             $server_port;
                       fastcgi_param   SERVER_NAME             $server_name;
    
                       fastcgi_param   HTTPS                   $https;
    
                       # PHP only, required if PHP was built with --enable-force-cgi-redirect
                       fastcgi_param   REDIRECT_STATUS         200;
                       # To access SquirrelMail, the default user (like www-data on Debian/Ubuntu) mu$
                       #fastcgi_pass 127.0.0.1:9000;
                       fastcgi_pass unix:/var/run/php5-fpm.sock;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       fastcgi_buffer_size 128k;
                       fastcgi_buffers 256 4k;
                       fastcgi_busy_buffers_size 256k;
                       fastcgi_temp_file_write_size 256k;
               }
               location ~* ^/roundcube/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /usr/share/;
               }
               location ~* /.svn/ {
                       deny all;
               }
               location ~* /README|INSTALL|LICENSE|SQL|bin|CHANGELOG$ {
                       deny all;
               }
    
        }
    

    Note: Debian users should change "root /usr/share/;" with "root /var/lib/;" throughout the configuration file (there are three places). Else they will get an 404 error as whatermark.