Nginx + apache doesn't work

No matter what templates I select, nginx files (html, css, etc) work and apache files (php) do not - 100% of the time no matter the settings, php files return 500 error.

To be clear I am doing a very basic <?php phpinfo(); ?>so its not a code error.

The only errors I get are:

[error] 1720510#1720510: *17 connect() failed (111: Connection refused) while connecting to upstream

Ports are open according to iptables -S

I don’t know what else to check.

Show the output of these commands:

grep '^Include' /etc/apache2/apache2.conf
ls -l /etc/apache2/conf.d/
apache2ctl configtest
apache2ctl -M | grep mpm
systemctl status apache2 --no-pager -l
lsof -Pn +c0 -i:8080,8443,9000 -sTCP:LISTEN
Include mods-enabled/*.load
Include mods-enabled/*.conf
Include ports.conf
IncludeOptional conf.d/*.conf
IncludeOptional conf.d/domains/webmail.*.conf
IncludeOptional conf.d/domains/*.conf
total 4
drwxr-xr-x 2 root root 4096 Jun  4 22:56 domains
Syntax OK
mpm_prefork_module (shared)
 apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-06-04 23:16:21 UTC; 8min ago
    Process: 1724187 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 1724191 (apache2)
      Tasks: 7 (limit: 9347)
     Memory: 21.3M
        CPU: 98ms
     CGroup: /system.slice/apache2.service
             ├─1724191 /usr/sbin/apache2 -k start
             ├─1724192 /usr/sbin/apache2 -k start
             ├─1724233 /usr/sbin/apache2 -k start
             ├─1724234 /usr/sbin/apache2 -k start
             ├─1724235 /usr/sbin/apache2 -k start
             ├─1724236 /usr/sbin/apache2 -k start
             └─1724237 /usr/sbin/apache2 -k start

Jun 04 23:16:21 systemd[1]: Starting The Apache HTTP Server...
Jun 04 23:16:21 systemd[1]: Started The Apache HTTP Server.
php-fpm8.1 1696252 root   11u  IPv4 19694967      0t0  TCP (LISTEN)

Here you should have a file for your ip conf a.b.c.d.conf, and two more files, hestia-event.conf to manage php files and

That’s weird, apache should use mpm_event instead of mpm_prefork

Apache should be listening on ports 8080 and 8443 but it’s not.

What is the OS and Hestia version? Did you reinstall apache manually or modify something?

Painful as this is I did an apt update and thats when problems began so chances are something got borked during the process and files probably got removed or replaced or something. I have had this running for the past year(ish) without issues.

22.04.4 LTS (Jammy Jellyfish)
Hestia v1.8.11

Let’s try to fix it.

mkdir -p /root/backup_apache/etc/
cp -rf /etc/apache2 /root/backup_apache/etc/
cp /usr/local/hestia/install/deb/apache2/apache2.conf /etc/apache2/apache2.conf
cp /usr/local/hestia/install/deb/apache2/hestia-event.conf /etc/apache2/conf.d/
a2dismod mpm_prefork
a2enmod mpm_event
systemctl restart apache2

Now, rebuild your site (replace YourUser and YourDomain by the actual data):

v-rebuild-web-domain YourUser YourDomain yes

This is just such a nightmare. lol

Now it is giving me errors when I try to restart about

Invalid command 'php_admin_value'

but even if I try removing or commenting them out, the error still says that.

I think the upgrade has been worse than expected. It looks like there is a mess on your server that will be difficult to fix.

If mod php is enabled you must disable it, check if it is enabled

apache2ctl -M | grep php

That also doesn’t work for a near identical error.

I suspect I am going to have to figure out how to back all this up with nothing working properly and do a fresh install, live and learn… don’t do updates or upgrades on linux servers when things already are working =/

1 Like

So I have’nt taken the plunge into reinstalling the server just yet.

I did get it to a point all of the above commands you listed work properly.

lsof -Pn +c0 -i:8080,8443,9000 -sTCP:LISTEN

above shows nothing now.

systemctl restart apache2

above now starts apache2


v-rebuild-web-domain YourUser YourDomain yes

this says failed to restart - yet ps ax shows apache is still running and the dashboard still says apache is running.

I know I am drawing at straws now, but any suggestions as to what to check at this point?

So before I go wiping out my server…

the installer no longer has any options to select nginx?

No nginx on the list at all.

nginx is a must have and will always be installed, that’s why you cant select it anymore.


So seeing as I have no means of backing anything up because everything relies on php to do backups and nothing php is working… is there anything I need to backup outside of /home?

v-backup-users will create a back up of all the users