Author Topic: Status code 504 at Test SMTP config or Test IMAP config  (Read 277 times)

Offline Gijs

  • Newbie
  • *
  • Posts: 2
Status code 504 at Test SMTP config or Test IMAP config
« on: August 27, 2020, 11:10:07 AM »
First time setting up a mail server, first time major issue:

Testing the SMTP or IMAP results in a 504 status code after some time

I've followed this guide for roundcube: https://www.linuxbabe.com/ubuntu/install-roundcube-webmail-ubuntu-20-04-apache-nginx

furthermore use:
  • debian 10 (Buster)
  • nginx 1.14.2
  • postfix 3.4.14
  • dovecot 2.3.4.1
  • roundcube 1.4.8
sudo nano /etc/nginx/sites-enabled/webmail.exampledomain.com
Code: [Select]
server {
        if ($host = webmail.exampledomain.com) {
                return 301 https://$host$request_uri;
        }

        listen 80;
        listen [::]:80;

        error_log /var/www/webmail.exampledomain.com/logs/error.log error;
        access_log /var/www/webmail.exampledomain.com/logs/access.log;

        server_name webmail.exampledomain.com www.webmail.exampledomain.com;
        return 404;
}

server {
        listen 443 ssl;
        listen [::]:443 ssl;
        ssl_certificate /etc/letsencrypt/live/webmail.exampledomain.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/webmail.exampledomain.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

        server_name webmail.exampledomain.com www.webmail.exampledomain.com;

        index index.php index.html index.htm;

        root /var/www/webmail.exampledomain.com/html;

        error_log /var/www/webmail.exampledomain.com/logs/error.log error;
        access_log /var/www/webmail.exampledomain.com/logs/access.log;

        client_max_body_size 10m;

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.4-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        location ~ /\.ht {
                deny all;
        }                                                                                                                                                                                                         

        location ~ /.well-known/acme-challenge {
                allow all;
        }

        location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
                deny all;
        }

        location ~ ^/(bin|SQL)/ {
                deny all;
        }


    add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot


    ssl_trusted_certificate /etc/letsencrypt/live/webmail.exampledomain.com/chain.pem; # managed by Certbot
    ssl_stapling on; # managed by Certbot
    ssl_stapling_verify on; # managed by Certbot
}

*Testing IMAP login*


then:
sudo tail /var/www/webmail.exampledomain.com/logs/error.log
Code: [Select]
2020/08/27 16:43:31 [error] 2236#2236: *73 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 162.158.159.14, server: webmail.groote.xyz, request: "POST /installer/index.php?_step=3 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock", host: "webmail.groote.xyz", referrer: "https://webmail.groote.xyz/installer/index.php?_step=3"

Does anyone know why I am receiving a 504 status code?


I will happily provide more config files


Offline Gijs

  • Newbie
  • *
  • Posts: 2
Re: Status code 504 at Test SMTP config or Test IMAP config
« Reply #1 on: September 02, 2020, 03:31:44 AM »
Error message was pretty straight forward. The file "fastcgi://unix:/run/php/php7.4-fpm.sock" could not be accessed because file "/run/php/php7.4-fmp.sock" did not exist.
creating the file with:

sudo nano /run/php/php7.4-fmp.sock
ctrl + o -> enter -> ctrl + x

restart the php7.4-fmp service:

sudo systemctl start php7.4-fpm.service

Check if everything works with:
sudo systemctl status php7.4-fpm.service

also these files have been created by the service:
/run/php/php7.4-fpm.pid
/run/php/php7.4-fpm.sock
/run/php/php-fpm.sock