Perfect Server with ISPConfig - 502 Gateway Error with Roundcube

Discussion in 'ISPConfig 3 Priority Support' started by tyzenker, Dec 16, 2016.

  1. tyzenker

    tyzenker Member

    I'm not sure if this is the right forum to use. I am using ISPConfig 3 with the standard Perfect Server Set-up for Nginx. Everything works fine except for Roundcube. Everything else runs without errors (web server, phpmyadmin, ftp, etc.).

    Roundcube is the only thing giving me problems. I have tried to troubleshoot it but was unsuccessful. Whenever I try to access (using the nginx directives), it constantly gives me a 502 Gateway Error.

    Below is the result of your diagnostic program:

    ##### SERVER #####
    IP-address (as per hostname): ***.***.***.***
    IP-address(es) (as per ifconfig): ***.***.***.***
    [INFO] ISPConfig is installed.

    ##### ISPCONFIG #####
    ISPConfig version is 3.1.1p1

    ##### VERSION CHECK #####

    [INFO] php (cli) version is 7.0.8-0ubuntu***.***.***.***

    ##### PORT CHECK #####

    [WARN] Port 443 (Webserver SSL) seems NOT to be listening

    ##### MAIL SERVER CHECK #####


    [INFO] I found the following web server(s):
    Nginx (PID 1295)
    [INFO] I found the following mail server(s):
    Postfix (PID 2445)
    [INFO] I found the following pop3 server(s):
    Dovecot (PID 1272)
    [INFO] I found the following imap server(s):
    Dovecot (PID 1272)
    [INFO] I found the following ftp server(s):
    PureFTP (PID 2266)

    ##### LISTENING PORTS #####
    (only ()
    Local (Address)
    [localhost]:10023 (2016/
    [localhost]:10024 (2446/amavisd-new)
    [localhost]:10025 (2445/master)
    [localhost]:10026 (2446/amavisd-new)
    [localhost]:10027 (2445/master)
    [anywhere]:587 (2445/master)
    [localhost]:11211 (1240/memcached)
    [anywhere]:110 (1272/dovecot)
    [anywhere]:143 (1272/dovecot)
    [anywhere]:80 (1295/nginx)
    [anywhere]:8080 (1295/nginx)
    [anywhere]:465 (2445/master)
    [anywhere]:8081 (1295/nginx)
    [anywhere]:21 (2266/pure-ftpd)
    ***.***.***.***:53 (1402/dnsmasq)
    ***.***.***.***:53 (1244/named)
    [localhost]:53 (1244/named)
    [anywhere]:22 (1234/sshd)
    [localhost]:631 (3881/cupsd)
    [anywhere]:25 (2445/master)
    [localhost]:953 (1244/named)
    [anywhere]:993 (1272/dovecot)
    [anywhere]:995 (1272/dovecot)
    *:*:*:*::*:10024 (2446/amavisd-new)
    *:*:*:*::*:10026 (2446/amavisd-new)
    *:*:*:*::*:3306 (2085/mysqld)
    *:*:*:*::*:587 (2445/master)
    [localhost]10 (1272/dovecot)
    [localhost]43 (1272/dovecot)
    *:*:*:*::*:80 (1295/nginx)
    *:*:*:*::*:8080 (1295/nginx)
    *:*:*:*::*:465 (2445/master)
    *:*:*:*::*:21 (2266/pure-ftpd)
    *:*:*:*::*:53 (1244/named)
    *:*:*:*::*:22 (1234/sshd)
    *:*:*:*::*:631 (3881/cupsd)
    *:*:*:*::*:25 (2445/master)
    *:*:*:*::*:953 (1244/named)
    *:*:*:*::*:993 (1272/dovecot)
    *:*:*:*::*:995 (1272/dovecot)

    ##### IPTABLES #####
    Chain INPUT (policy ACCEPT)
    target prot opt source destination
    f2b-dovecot-pop3imap tcp -- [anywhere]/0 [anywhere]/0 m
    ultiport dports 110,995,143,993
    f2b-pureftpd tcp -- [anywhere]/0 [anywhere]/0 multiport
    dports 21
    f2b-postfix-sasl tcp -- [anywhere]/0 [anywhere]/0 multi
    port dports 25
    f2b-sshd tcp -- [anywhere]/0 [anywhere]/0 multiport dp
    orts 22

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    Chain f2b-dovecot-pop3imap (1 references)
    target prot opt source destination
    RETURN all -- [anywhere]/0 [anywhere]/0

    Chain f2b-postfix-sasl (1 references)
    target prot opt source destination
    RETURN all -- [anywhere]/0 [anywhere]/0

    Chain f2b-pureftpd (1 references)
    target prot opt source destination
    RETURN all -- [anywhere]/0 [anywhere]/0

    Chain f2b-sshd (1 references)
    target prot opt source destination
    REJECT all -- ***.***.***.*** [anywhere]/0 reject-with icm
    REJECT all -- ***.***.***.*** [anywhere]/0 reject-with ic
    REJECT all -- ***.***.***.*** [anywhere]/0 reject-with ic
    RETURN all -- [anywhere]/0 [anywhere]/0

    Do you have any idea how I can fix this?
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which exact tutorial did you use? and you installed roundcube directly into the website, right? As the perfect server guides install the webmail clients on port 8081 and not port 80.
  3. tyzenker

    tyzenker Member

    There was no Perfect Server Guide to use Nginx, the newest PHP, and Ubuntu 16.04 with Roundcube. I had to mix two different Perfect Server Guides, along with the Roundcube Guide. The Roundcube Guide that I used was:

    As I said before, everything is working great except for Roundcube. Obviously, I screwed something up. I'm trying to figure a way to get it working. It must be a configuration problem. Also, I don't know how to changed the Port 80 setting back to Port 8081. Is there anyway that you can help? Or give suggestions?
  4. tyzenker

    tyzenker Member

  5. tyzenker

    tyzenker Member

    After re-doing it, and going to, I got the following error:

    CONFIGURATION ERROR was not found.
    Please read the INSTALL instructions!

    However, I have in my /etc/roundcube folder. So, I don't know why it says it wasn't found.

    I am stumped. Do you have any suggestions?
    Last edited: Dec 16, 2016
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The first guide that you used should work as well, the reason that it did not work was that you use php 7 and not php 5 on Ubuntu 16.04 so thet the socket file path:

    fastcgi_pass unix:/var/run/php5-fpm.sock;

    is probably wrong. Most likely it is:

    fastcgi_pass unix:/var/run/php7.0-fpm.sock;

    or similar, take a look into the /var/run folder to see what the right socket is.

    The guide from 12/1/2016 is for Debian jessie and not ubuntu, if I understand you correctly, you are using Ubuntu and not Debian, so the php version and paths don't match.
  7. tyzenker

    tyzenker Member

    I changed Nginx directive to what you suggested, but I am still getting the same error. (It was changed to: fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; )

    Also, would open_basedir have an effect on the PHP level? It currently shows: /usr/share/php5:/usr/share/php (The directory for php 7.0 seems to be as follows: /usr/share/php )

    I am still getting the same error.
  8. tyzenker

    tyzenker Member

    Can you recommend what guide that I should use?
  9. tyzenker

    tyzenker Member

    Can I use these instructions for Ubuntu / Nginx / Roundcube ?

    18 Install RoundCube
    Roundcube is not available in the Debian 8 main repository, but we can get it trough the backports.

    Install RoundCube with this command:

    apt-get install roundcube roundcube-core roundcube-mysql roundcube-plugins

    The installer will ask the following questions:

    Configure database for roundcube with dbconfig.common? <-- yes
    Select the database type: <-- mysql
    Password of the databases administrative user: <-- enter the MySQL root password here.
    MySQL application password for roundcube: <-- press enter

    Then edit the RoundCube /etc/roundcube/ file and adjust a few settings:

    nano /etc/roundcube/

    Set the default_host and smtp_server to localhost.

    $config['default_host'] = 'localhost';
    $config['smtp_server'] = 'localhost';
    ISPConfig has some configuration in the nginx apps vhost for squirrelmail which works for roundcube as well. We activate it with:

    ln -s /usr/share/roundcube /usr/share/squirrelmail

    Now you can access RoundCube as follows: (after you have installed ISPConfig, see the next chapter)

  10. tyzenker

    tyzenker Member

    I still have the error:
    "CONFIGURATION ERROR was not found.
    Please read the INSTALL instructions!"

    I followed the instructions in my last post, and still go the same error. Then, I took a chance and decided to type in the roundcube installer. Below are the results that I got.


    The only thing that appears to be wrong is the line:
    Net_IDNA2: NOT OK(Failed to load class Net_IDNA2 from; See

    However, PHP and all it's libraries seem to be installed. Do you have any idea what this could be caused by?
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post a "ls -la" of the file. maybe it has a wrong owner or wrong permissions.
  12. tyzenker

    tyzenker Member

    -rw-r----- 1 root www-data 3668 Dec 16 17:40

    Is that correct?
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    try to change the owner to user and group www-data.
  14. tyzenker

    tyzenker Member

    I don't have "user" as an option in the drop-down menu for "Owner:" I have www-data, administrator, and root. But no "user". I have the group "users", but no option for "user" in owner.

    Could that be the problem? Everything else on the server works.

    Do I need to create a new user? Or is there a command that I should use? Maybe I'm just confused about what you're saying.
    Last edited: Dec 19, 2016
  15. tyzenker

    tyzenker Member

    Are you saying that for "Others Access:" that I should enable "read and write"? Should I enable "read and write" for everything on In order to test it?
  16. till

    till Super Moderator Staff Member ISPConfig Developer


    chown www-data:www-data

    If this does not help then you can try to do a chmod to 755 temporarily.
  17. tyzenker

    tyzenker Member

    I just enabled all access on the /etc/roundcube folder, sub-folders, and files in order to see what would happen. You can see the screen-shot below. Suddenly, the Roundcube Login Window finally showed up. Obviously, I don't want to give full permissions to the entire Roundcube folder.

    I am going to try what you suggested and then write back in about 10 minutes.

    Attached Files:

  18. tyzenker

    tyzenker Member

    Before I start, I want to say thank you so much. I know that I am taking up your time, and thank you for the help. Okay, here are the results of what you suggested.

    1) chown www-data:www-data
    When I did "chown www-data:www-data", it still showed "CONFIGURATION ERROR: was not found." (on https://localhost:8081/webmail/)

    2) chmod 755
    When I did "chmod 755", it caused the https://localhost:8081/webmail screen to be blank (just a blank white page on the browser).

    3) Full Permissions to Roundcube Folders, Sub-Folders, and Files
    When I gave all the Roundcube Folders, Sub-Folders, and Files full read and write permissions, the Roundcube Screen finally showed up. However, I can't give all the files and folders full permissions.

    So, what do you think? My guess is that it's a folder permission problem too, right? Or maybe we can have to change permissions for more than one file? What should I do next?

    What permissions should I give the Roundcube folder and Roundcube files? Is there any way that I can narrow this down?
    Last edited: Dec 19, 2016
  19. tyzenker

    tyzenker Member

    I just did another re-install of Perfect Server (along with the Round Cube instructions above), and the same thing happened. It always brings me back to the same error with Roundcube. So, the Permissions problem must happen upon the install.

    Is there anyway to fix the permissions problem in the last post? I just need to know the permissions to give the Roundcube Folder and the files.
  20. tyzenker

    tyzenker Member

    I've narrowed it down to permissions for 2 files:
    2) debian-db.php

    It seems if I allow full read and write access to both files, then the Round Cube login screen shows up. After the login screen shows up, then I can change the "Others Access" to Read-Only. However, I'm not sure if that's a secure permission.

    Below are my original settings of both files. After I change "Others Access" to Read and Write, then the Round Cube Screen finally shows up.

    This is my final question: What permission rights should and debian-db.php have to be secure and still work properly?

    Attached Files:

    luigi mangili likes this.

Share This Page