Roundcube showing source code

Hi,

I know there is a a fix for this, but I can’t for the life of me find it again! I’m trying to use Roundcube on a server I set up a while ago. With one of the installers, it didn’t do something right around enabling a module of some sorts. I seem to remember its just a case of running a command or 2 … but I can’t remember which modules it was!

Does anyone remember? Currently all I get is the PHP source code showing at webmail.mysite.com :slight_smile:

Cheers

Andy

Hi,

If you mean mpm apache modules, check what is the mpm you are using:

apache2ctl -M 2>/dev/null | grep mpm

If you are using mpm_prefork, the you should disable it and enable mpm_event:

a2dismod mpm_prefork
a2enmod mpm_event
systemctl restart apache2

Thanks. Unfortunately I now get this on all sites:

or] 2950595#2950595: *63988 upstream prematurely closed connection while reading response header from upstream, client: 81.174.134.33, server: deor.nl, request: “GET /favicon.ico HTTP/2.0”, upstream: “https://172.105.244.200:8443/favicon.ico”, host: “deor.nl”, referrer: “https://deor.nl/

I’m using apache + ngninx


 apache2ctl -M 2>/dev/null | grep mpm
 mpm_event_module (shared)

in /var/log/apache2/error.log, I see:

[Thu Feb 22 12:27:33.619135 2024] [core:notice] [pid 2969247:tid 140141788768128] AH00051: child pid 2970036 exit signal Abort (6), possible coredump in /etc/apache2

Show the output of these commands:

php -v
find /etc/php -name "www.conf"
lsof -Pn +c0 -i:9000 -sTCP:LISTEN


php -v
PHP 8.2.8 (cli) (built: Jul  8 2023 07:10:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies

find /etc/php -name "www.conf"
/etc/php/8.2/fpm/pool.d/www.conf

lsof -Pn +c0 -i:9000 -sTCP:LISTEN
COMMAND        PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
php-fpm8.2 2967207 root   10u  IPv4 234883350      0t0  TCP 127.0.0.1:9000 (LISTEN)

BTW, reversing the process again - ie


a2dismod mpm_event
a2enmod mpm_prefork
systemctl restart apache2

the sites come back up, but roundcube doesn’t work again :rofl:

Ok, show the output of these commands:

cat /etc/php/8.2/fpm/pool.d/www.conf
cat /etc/apache2/conf.d/hestia-event.conf

If the last cat doesn’t work:

cp /usr/local/hestia/install/deb/apache2/hestia-event.conf /etc/apache2/conf.d/

Disable mpm_prefork, enable mpm_event and restart apache2

Here you go:

root@bb:/home/deor/web/deor.nl/logs# cat /etc/php/8.2/fpm/pool.d/www.conf
; origin-src: deb/php-fpm/www.conf

[www]
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1

user = hestiamail
group = www-data

pm = ondemand
pm.max_children = 4
pm.max_requests = 4000
pm.process_idle_timeout = 10s
root@bb:/home/deor/web/deor.nl/logs# cat /etc/apache2/conf.d/hestia-event.conf
<IfModule mpm_event_module>
    <FilesMatch \.php$>
        SetHandler "proxy:fcgi://127.0.0.1:9000"
    </FilesMatch>
</IfModule>r

That looks fine, apache is now using mpm_event or mpm_prefork?

What’s the result of this command:

diff -u /usr/local/hestia/install/deb/apache2/apache2.conf /etc/apache2/apache2.conf

What problems did you have installing Hestia?

Don’t forget to rebuild mail domains

Had the same issues last night including with the"Hestia" server last night…

Thanks all. Sorry, I had to go out for lunch :slight_smile: So for that command @sahsanu

 diff -u /usr/local/hestia/install/deb/apache2/apache2.conf /etc/apache2/apache2.conf
--- /usr/local/hestia/install/deb/apache2/apache2.conf  2023-11-27 19:40:32.000000000 +0000
+++ /etc/apache2/apache2.conf   2023-08-11 12:46:12.188674862 +0000
@@ -74,8 +74,8 @@
 Include ports.conf

 LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
-LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
-LogFormat "%h %l %u %t \"%r\" %>s %O" common
+LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%a %l %u %t \"%r\" %>s %O" common
 LogFormat "%{Referer}i -> %U" referer
 LogFormat "%{User-agent}i" agent
 LogFormat "%b" bytes
Don’t forget to rebuild mail domains

Had the same issues last night including with the"Hestia" server last night…

@eris Any particular command? I tried doing it as an admin in the GUI, and selected all > rebuild all. But still gives a 500 IS error with:

2024/02/22 13:56:08 [error] 2969693#2969693: *7013 upstream prematurely closed connection while reading response header from upstream, client: 81.174.134.33, server: deor.nl, request: "GET /favicon.ico/ HTTP/2.0", upstream: "https://172.105.244.200:8443/favicon.ico/", host: "www.deor.nl", referrer: "https://www.deor.nl/"

Thanks :slight_smile:

Probably it takes to long as the connection has been closed (I think it is bij default 30 or 60 seconds)

Als the main reason why we removed the possibility to update via web ui…

v-rebuild-mail-domain USER DOMAIN

or

v-rebuild-mail-domains USER

If you want to rebuild all (mail, web, dns, etc.):

v-rebuild-all USER yes

The last yes is to restart the services:

Unfortunately I still get a 500 IS error :frowning: I’ll have another play when I can. The issue is that this is a live server, and every time it comes up with 500 IS errors for end users, I get complaints :frowning: For the moment, only the webmail doesn’t work - so I may just have to put up with that

Coming back to this, I can’t figure it out still. I’m comparing files. /var/lib/roundcube on the server that isn’t working, had files as root:root. I’ve looked at 2 other server (where it works), and it was root:hestiamail. So I’ve sorted that. But it still doesn’t run.

What config actually tells the webmail domain to run the PHP? Comparing 2 sites mail config files for nginx, I see:

This webmail one works (on another server)

server {
	
    listen      172.233.60.35:80;
    listen      [::]:80;
	server_name webmail.zichtopmedia.nl mail.zichtopmedia.nl;
	root        /var/lib/roundcube;
	index       index.php index.html index.htm;
	access_log  /var/log/nginx/domains/webmail.zichtopmedia.nl.log combined;
	error_log   /var/log/nginx/domains/webmail.zichtopmedia.nl.error.log error;

	include /home/zichtopmed/conf/mail/zichtopmedia.nl/nginx.forcessl.conf*;

	location ~ /\.(?!well-known\/) {
		deny all;
		return 404;
	}

	location ~ ^/(README.md|config|temp|logs|bin|SQL|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
		deny all;
		return 404;
	}

	location / {
		alias /var/lib/roundcube/;

		try_files $uri $uri/ =404;

		proxy_pass http://172.233.60.35:8080;

		location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
			expires 7d;
			fastcgi_hide_header "Set-Cookie";
		}
	}

	location @fallback {
		proxy_pass http://172.233.60.35:8080;
	}

	location /error/ {
		alias /var/www/document_errors/;
	}

	include /home/zichtopmed/conf/mail/zichtopmedia.nl/nginx.conf_*;
}

This one doesn’t (on the new server)

server {
	
    listen      172.105.244.200:80;
    listen      [::]:80;
	server_name webmail.businessbookers.nl mail.businessbookers.nl;
	root        /var/lib/roundcube;
	index       index.php index.html index.htm;
	access_log  /var/log/nginx/domains/webmail.businessbookers.nl.log combined;
	error_log   /var/log/nginx/domains/webmail.businessbookers.nl.error.log error;

	include /home/businessbo/conf/mail/businessbookers.nl/nginx.forcessl.conf*;

	location ~ /\.(?!well-known\/) {
		deny all;
		return 404;
	}

	location ~ ^/(README.md|config|temp|logs|bin|SQL|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
		deny all;
		return 404;
	}

	location / {
		alias /var/lib/roundcube/;

		try_files $uri $uri/ =404;

		proxy_pass http://172.105.244.200:8080;

		location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
			expires 7d;
			fastcgi_hide_header "Set-Cookie";
		}
	}

	location @fallback {
		proxy_pass http://172.105.244.200:8080;
	}

	location /error/ {
		alias /var/www/document_errors/;
	}

	include /home/businessbo/conf/mail/businessbookers.nl/nginx.conf_*;
}

So apart from the IP’s being different and the paths (username and domain), I don’t see any difference.

Hmmm there must be something else going on.

mpm_prefork is disabled - mpm_event is enabled. Apache is restarted:

root@bb:/etc/apache2/mods-enabled# ls -lh
total 4.0K
lrwxrwxrwx 1 root root  36 Aug 11  2023 access_compat.load -> ../mods-available/access_compat.load
lrwxrwxrwx 1 root root  30 Aug 11  2023 actions.conf -> ../mods-available/actions.conf
lrwxrwxrwx 1 root root  30 Aug 11  2023 actions.load -> ../mods-available/actions.load
lrwxrwxrwx 1 root root  28 Aug 11  2023 alias.conf -> ../mods-available/alias.conf
lrwxrwxrwx 1 root root  28 Aug 11  2023 alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root  33 Aug 11  2023 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root  33 Aug 11  2023 authn_core.load -> ../mods-available/authn_core.load
lrwxrwxrwx 1 root root  33 Aug 11  2023 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root  33 Aug 11  2023 authz_core.load -> ../mods-available/authz_core.load
lrwxrwxrwx 1 root root  38 Aug 11  2023 authz_groupfile.load -> ../mods-available/authz_groupfile.load
lrwxrwxrwx 1 root root  33 Aug 11  2023 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root  33 Aug 11  2023 authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root  32 Aug 11  2023 autoindex.conf -> ../mods-available/autoindex.conf
lrwxrwxrwx 1 root root  32 Aug 11  2023 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root  26 Aug 11  2023 cgi.load -> ../mods-available/cgi.load
lrwxrwxrwx 1 root root  30 Aug 11  2023 deflate.conf -> ../mods-available/deflate.conf
lrwxrwxrwx 1 root root  30 Aug 11  2023 deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root  26 Aug 11  2023 dir.conf -> ../mods-available/dir.conf
lrwxrwxrwx 1 root root  26 Aug 11  2023 dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root  26 Aug 11  2023 env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root  28 Aug 11  2023 fcgid.conf -> ../mods-available/fcgid.conf
lrwxrwxrwx 1 root root  28 Aug 11  2023 fcgid.load -> ../mods-available/fcgid.load
lrwxrwxrwx 1 root root  29 Aug 11  2023 filter.load -> ../mods-available/filter.load
lrwxrwxrwx 1 root root  36 Aug 11  2023 hestia-status.conf -> ../mods-available/hestia-status.conf
lrwxrwxrwx 1 root root  36 Aug 11  2023 hestia-status.load -> ../mods-available/hestia-status.load
lrwxrwxrwx 1 root root  27 Aug 11  2023 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx 1 root root  27 Aug 11  2023 mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root  32 Feb 23 13:54 mpm_event.conf -> ../mods-available/mpm_event.conf
lrwxrwxrwx 1 root root  32 Feb 23 13:54 mpm_event.load -> ../mods-available/mpm_event.load
lrwxrwxrwx 1 root root  34 Aug 11  2023 negotiation.conf -> ../mods-available/negotiation.conf
lrwxrwxrwx 1 root root  34 Aug 11  2023 negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root  27 Aug 11  2023 perl.load -> ../mods-available/perl.load
lrwxrwxrwx 1 root root  28 Aug 11  2023 proxy.conf -> ../mods-available/proxy.conf
lrwxrwxrwx 1 root root  33 Aug 11  2023 proxy_fcgi.load -> ../mods-available/proxy_fcgi.load
lrwxrwxrwx 1 root root  28 Aug 11  2023 proxy.load -> ../mods-available/proxy.load
lrwxrwxrwx 1 root root  31 Aug 11  2023 remoteip.conf -> ../mods-available/remoteip.conf
lrwxrwxrwx 1 root root  31 Aug 11  2023 remoteip.load -> ../mods-available/remoteip.load
lrwxrwxrwx 1 root root  33 Aug 11  2023 reqtimeout.conf -> ../mods-available/reqtimeout.conf
lrwxrwxrwx 1 root root  33 Aug 11  2023 reqtimeout.load -> ../mods-available/reqtimeout.load
lrwxrwxrwx 1 root root  30 Aug 11  2023 rewrite.load -> ../mods-available/rewrite.load
-rw-r--r-- 1 root root 469 Aug 11  2023 rpaf.conf
lrwxrwxrwx 1 root root  27 Aug 11  2023 rpaf.load -> ../mods-available/rpaf.load
lrwxrwxrwx 1 root root  28 Aug 11  2023 ruid2.load -> ../mods-available/ruid2.load
lrwxrwxrwx 1 root root  31 Aug 11  2023 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx 1 root root  31 Aug 11  2023 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root  36 Aug 11  2023 socache_shmcb.load -> ../mods-available/socache_shmcb.load
lrwxrwxrwx 1 root root  26 Aug 11  2023 ssl.conf -> ../mods-available/ssl.conf
lrwxrwxrwx 1 root root  26 Aug 11  2023 ssl.load -> ../mods-available/ssl.load
lrwxrwxrwx 1 root root  29 Aug 11  2023 suexec.load -> ../mods-available/suexec.load

Then I rebuild all the users:

#!/bin/bash
source /etc/hestiacp/hestia.conf
source $HESTIA/func/main.sh

for user in $($BIN/v-list-users plain | cut -f1 ); do
    echo "Doing user: $user"
    $BIN/v-rebuild-all $user
done

Which runs through with no errors, apart from:

Error: DNS_SYSTEM is not enabled

Could that be causing the issue?

Cheers

Andy

OMG If ound it!!!

bash /usr/local/hestia/install/upgrade/manual/migrate_mpm_event.sh

and now it works :rofl:

1 Like

That script basically do what we already did but it also disables php modules in Apache and that should be the reason it wasn’t working only disabling prefork and enabling event.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.