NGiNX gives 404 for /webmail

Discussion in 'Installation/Configuration' started by JettB, Jul 27, 2021.

  1. JettB

    JettB New Member

    Just did a fresh install of ISPConfig 3, using NGiNX and the autoinstaller. Server private IP is 192.167.77.100. When accessing /webmail from the jettburns. com domain it gives an ISPConfig 404, 192.167.77.100:8080/webmail gives NGiNX 404, and 192.167.77.100:8081/webmail reidrects to /squirrelmail saying:
    "CONFIGURATION ERROR
    config.inc.php was not found.
    Please read the INSTALL instructions!"

    I checked the FAQ and looked around but I can't find info or help on this specific issue. There seems to be an issue with database permissions, but I'm not sure why since I used the autoinstaller.

    Here's logs, let me know if you need other info:

    /var/www/jettburns.com/log/error.log (when accessing from phone connecting to jettburns. com/webmail)
    Code:
    2021/07/26 21:44:17 [error] 593902#593902: *999 "/var/www/jettburns.com/web/squirrelmail/index.html" is not found (2: No such file or directory), client: 195.***.***.***, server: jettburns.com, request: "GET /squirrelmail/ HTTP/2.0", host: "jettburns.com"
    2021/07/26 21:44:18 [error] 593902#593902: *999 "/var/www/jettburns.com/web/squirrelmail/index.html" is not found (2: No such file or directory), client: 195.***.***.***, server: jettburns.com, request: "GET /squirrelmail/ HTTP/2.0", host: "jettburns.com"
    2021/07/26 21:44:22 [error] 593902#593902: *999 "/var/www/jettburns.com/web/webmail/index.html" is not found (2: No such file or directory), client: 195.***.***.***, server: jettburns.com, request: "GET /webmail/ HTTP/2.0", host: "jettburns.com"
    Code:
    [email protected]:~# ls /var/www/jettburns.com/web/squirrelmail/
    ls: cannot access '/var/www/jettburns.com/web/squirrelmail/': No such file or directory
    [email protected]:~# ls -la /var/www/jettburns.com/web/
    total 32
    drwxr-x--x  4 web1 client1 4096 Jul 25 02:53 .
    drwxr-xr-x 10 root root    4096 Jul 26 00:06 ..
    drwxr-xr-x  2 web1 client1 4096 Jul 25 02:53 error
    -rwxr-xr--  1 web1 client1 7358 Jul 25 02:53 favicon.ico
    -rwxr-xr--  1 web1 client1   14 Jul 25 02:53 robots.txt
    -rwxr-xr--  1 web1 client1 1862 Jul 25 02:53 standard_index.html
    drwxr-xr-x  2 web1 client1 4096 Jul 26 00:06 stats
    /var/log/nginx/error.log (when connecting from laptop to 192.167.77.100:8080/webmail and 192.167.77.100:8081/webmail)
    Code:
    2021/07/26 22:08:32 [error] 593902#593902: *1013 "/usr/local/ispconfig/interface/web/webmail/index.php" is not found (2: No such file or directory), client: 192.168.168.65, server: _, request: "GET /webmail/ HTTP/2.0", host: "192.167.77.100:8080"
    
    2021/07/26 22:08:44 [error] 593902#593902: *1015 FastCGI sent in stderr: "PHP message: PHP Warning:  file_put_contents(/var/log/roundcube/errors.log): failed to open stream: Permission denied in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1308PHP message: PHP Warning:  SQLSTATE[HY000] [1045] Access denied for user 'roundcube'@'localhost' (using password: NO) in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1419PHP message: PHP Warning:  file_put_contents(/var/log/roundcube/errors.log): failed to open stream: Permission denied in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1308PHP message: PHP Warning:  config.inc.php was not found. in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1419" while reading response header from upstream, client: 192.168.168.65, server: _, request: "GET /squirrelmail/ HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.4-fpm/apps.sock:", host: "192.167.77.100:8081"
    
    2021/07/26 22:08:44 [error] 593902#593902: *1015 FastCGI sent in stderr: "PHP message: PHP Warning:  file_put_contents(/var/log/roundcube/errors.log): failed to open stream: Permission denied in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1308PHP message: PHP Warning:  SQLSTATE[HY000] [1045] Access denied for user 'roundcube'@'localhost' (using password: NO) in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1419PHP message: PHP Warning:  file_put_contents(/var/log/roundcube/errors.log): failed to open stream: Permission denied in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1308PHP message: PHP Warning:  config.inc.php was not found. in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1419" while reading response header from upstream, client: 192.168.168.65, server: _, request: "GET /squirrelmail/ HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.4-fpm/apps.sock:", host: "192.167.77.100:8081"
    Some of history since installing
    Code:
        1  nano /etc/hosts
        2  nano /etc/hostname
        3  hostname -f
        4 systemctl reboot
        5  hostname -f
        6  apt update && apt upgrade
        7  curl https://get.acme.sh | sh -s
        8  certbot
        9  snap install certbot
       10  snap install certbot --classic
       11  certbot
       12  wget -O - https://get.ispconfig.org | sh -s -- --use-nginx
       13  exit
       14  sudo certbot --nginx
       15  certbot --nginx
       16  acme
       17  ls /var/log
       18  ls /var/log/nginx/
       19  ls /var/log/nginx/error.log 
    
    Code:
    PHP 7.4.21 (cli) (built: Jul  1 2021 16:09:41) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies
    Code:
    No LSB modules are available.
    Distributor ID:    Ubuntu
    Description:    Ubuntu 20.04.2 LTS
    Release:    20.04
    Codename:    focal
    Code:
    ##### SERVER #####
    IP-address (as per hostname): ***.***.***.***
    [WARN] could not determine server's ip address by ifconfig
    [INFO] OS version is Ubuntu 20.04.2 LTS
    
    [INFO] uptime:  21:13:02 up 1 day, 20:23,  1 user,  load average: 0.11, 0.04, 0.01
    
    [INFO] memory:
                  total        used        free      shared  buff/cache   available
    Mem:           30Gi       2.3Gi        24Gi        48Mi       4.1Gi        27Gi
    Swap:         8.0Gi          0B       8.0Gi
    
    [INFO] systemd failed services status:
      UNIT LOAD ACTIVE SUB DESCRIPTION
    0 loaded units listed.
    
    [INFO] ISPConfig is installed.
    
    ##### ISPCONFIG #####
    ISPConfig version is 3.2.5
    
    ##### VERSION CHECK #####
    
    [INFO] php (cli) version is 7.4.21
    [INFO] php-cgi (used for cgi php in default vhost!) is version 7.4.21
    
    ##### PORT CHECK #####
    
    ##### MAIL SERVER CHECK #####
    
    ##### RUNNING SERVER PROCESSES #####
    [INFO] I found the following web server(s):
            Unknown process (nginx:) (PID 593901)
    [INFO] I found the following mail server(s):
            Postfix (PID 185420)
    [INFO] I found the following pop3 server(s):
            Dovecot (PID 185438)
    [INFO] I found the following imap server(s):
            Dovecot (PID 185438)
    [INFO] I found the following ftp server(s):
            PureFTP (PID 185507)
    
    ##### LISTENING PORTS #####
    (only           ()
    Local           (Address)
    [anywhere]:995          (185438/dovecot)
    [localhost]:11332               (185428/rspamd:)
    [localhost]:11333               (185428/rspamd:)
    [localhost]:11334               (185428/rspamd:)
    [localhost]:10023               (56423/postgrey)
    [anywhere]:587          (185420/master)
    [localhost]:11211               (94830/memcached)
    [localhost]:6379                (56128/redis-server)
    [anywhere]:110          (185438/dovecot)
    [anywhere]:143          (185438/dovecot)
    [anywhere]:80           (593901/nginx:)
    [anywhere]:8080         (593901/nginx:)
    [anywhere]:8081         (593901/nginx:)
    [anywhere]:465          (185420/master)
    ***.***.***.***:53              (186180/named)
    [localhost]:53          (186180/named)
    [anywhere]:21           (185507/pure-ftpd)
    ***.***.***.***:53              (912/systemd-resolve)
    [anywhere]:22           (967/sshd:)
    [localhost]:953         (186180/named)
    [anywhere]:25           (185420/master)
    [anywhere]:443          (593901/nginx:)
    [anywhere]:4190         (185438/dovecot)
    [anywhere]:993          (185438/dovecot)
    *:*:*:*::*:995          (185438/dovecot)
    *:*:*:*::*:3306         (184752/mysqld)
    *:*:*:*::*:587          (185420/master)
    *:*:*:*::*:6379         (56128/redis-server)
    [localhost]10           (185438/dovecot)
    [localhost]43           (185438/dovecot)
    *:*:*:*::*:80           (593901/nginx:)
    *:*:*:*::*:8080         (593901/nginx:)
    *:*:*:*::*:8081         (593901/nginx:)
    *:*:*:*::*:465          (185420/master)
    *:*:*:*::*d094:3cff:fee9:53             (186180/named)
    *:*:*:*::*:53           (186180/named)
    *:*:*:*::*:21           (185507/pure-ftpd)
    *:*:*:*::*:22           (967/sshd:)
    *:*:*:*::*:25           (185420/master)
    *:*:*:*::*:953          (186180/named)
    *:*:*:*::*:443          (593901/nginx:)
    *:*:*:*::*:4190         (185438/dovecot)
    *:*:*:*::*:993          (185438/dovecot)
    
    ##### IPTABLES #####
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    ##### LET'S ENCRYPT #####
    acme.sh is installed in /root/.acme.sh/acme.sh
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Which auto installer did you use?
     
  3. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Strange that squirrealmail can be involved in any way. Was the host you installed on already using squirrelmail? ISPConfig should be installed on a fresh from scratch installed OS with only the specified configurations done. There is tutorial https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
    The auto installer you should be using is the one made by ISPConfig project, instructions on the https://www.ispconfig.org/documentation/ Documentation page.
     
  4. JettB

    JettB New Member

  5. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    On nginx, /webmail does not work if I recall correctly. You can use server1.example:8081/webmail.
     
  6. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Where in the manual is this noted? This should not be done. The autoinstaller installs acme.sh, or certbot if requested so.
     
  7. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    It is correct if RC cannot be opened from yourdomain.tld/webmail and yourlocalip:8080/webmail by ISPConfig default installation.

    For yourdomain.tld/webmail to work you need to add nginx directives to yourdomain.tld.vhost via Options tab as described in https://www.howtoforge.com/tutorial...and-ispconfig-3/3/#-install-roundcube-webmail.

    It is not advisable to use port 8080 for your webmail in nginx server as ISPConfig uses it by default, so the default yourlocalip:8081/webmail seems correctly accessible, though seems like RC has not been properly installed.
     
    Last edited: Jul 27, 2021
  8. JettB

    JettB New Member

    @Th0m Yes, I tried accessing domain.tld:8081/webmail but I haven't setup firewall NAT, so it obviously says refused to connect. Like I described above, when I connect with serverlocalip:8081/webmail it redirects to serverlocalip:8081/squirrelmail saying:
    CONFIGURATION ERROR
    config.inc.php was not found.
    Please read the INSTALL instructions!

    Section 3.1 in the "ISPConfig 3.1 Manual" (Single Server Setup) says:
    You can find setup instructions for various versions of Debian, Ubuntu, CentOS, Fedora, and OpenSUSE on http://www.ispconfig.org/documentation/. It is strongly recommended to follow these to set up your Linux server before you install ISPConfig 3.1. As ISPConfig 3.1 contains some new features like support for HHVM, Let's Encrypt and the Metronome XMPP Server, and these features are not covered by the older setup instructions on http://www.ispconfig.org/documentation/, please check out chapters 3.1.1 (HHVM and Let's Encrypt) and 3.1.2 (Metronome XMPP) if you want to use Let's Encrypt and Metronome Chat with ISPConfig 3.1 (otherwise proceed to chapter 3.1.3). These must be set up before installing ISPConfig 3.1.

    Not sure if I'm supposed to install LE/Certbot manually before running this autoinstaller, but I had trouble with LE before so decided to manual install.

    @ahrasis Yeah I figured it was only 8081. Okay I'll try that suggestion. Any idea why RC wasn't properly installed with the autoinstaller? Need more logs/info?
     
  9. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What shows
    Code:
    ls -lhd /etc/roundcube/
    ls -lh /etc/roundcube/config.inc.php
    When I have stubled on that config.inc.php was not found. -error with Roundcube it has been wrong owner or permission.
     
  10. JettB

    JettB New Member

    @Taleman
    Code:
    ~$ ls -lhd /etc/roundcube/
    drwxr-xr-x 3 root root 4.0K Jul 26 21:44 /etc/roundcube/
    ~$ ls -lh /etc/roundcube/config.inc.php
    -rw-r----- 1 root www-data 3.8K Jul 26 21:44 /etc/roundcube/config.inc.php
     
  11. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I have same owners and permissions. It works with Apache, is NGINX different what user it runs as?
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

  13. JettB

    JettB New Member

    @till Those commands fixed the issue, mostly! After connecting to serverlocalip:8081/webmail it redirected to serverlocalip:8081/squirrelmail and displayed the Roundcube login screen. Mail was successfully delivered after testing!

    However, I get a ISPConfig 404 error when I access domain.tld/webmail or domain.tld/squirrelmail. Also, domain.tld/webmail redirects to domain.tld/roundcube, which gives a 404.

    I tried fixing this by adding the NGiNX directives to the domain.tld site options as described in the guide @ahrasis posted, but I get the same configuration error as before:
    "CONFIGURATION ERROR
    config.inc.php was not found.
    Please read the INSTALL instructions!"

    For the record, here are the commands which fixed my main issue, when run as root or with sudo:
    Code:
    chown root:ispapps /etc/roundcube/debian-db.php
    chmod 640 /etc/roundcube/debian-db.php
    chown root:ispapps /etc/roundcube/config.inc.php
    chmod 640 /etc/roundcube/config.inc.php
    chown -R ispapps:adm /var/log/roundcube
    chmod -R 750 /var/log/roundcube
    chown -R ispapps:ispapps /var/lib/roundcube/temp
    chmod -R 750 /var/lib/roundcube/temp
    
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Thast#s perfectly fine as this way to access RoundCube exists only on Apache servers but not Nginx servers. For Nginx systems, Roundcube is available on port 8081 only.
     
  15. JettB

    JettB New Member

    @till I understand, so there is no way to use the site's NGiNX options/directives to "reroute" or display roundcube on port 80 or 443? I feel like @ahrasis was close to accomplishing this, since I got a roundcube error on domain.tld/webmail. It would be nice if this worked.
     
  16. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I think it should work, the nginx directive in yourdomain.tld.vhost to use RC, but I think you just have to make sure the path is correct.

    Please check the correct RC location on your server and the nginx directive you used.
     

Share This Page