blog:apache:apache_troubleshooting

Apache Troubleshooting

Apache running in Lubuntu Linux stopped accepting connections on https://localhost. The error said “localhost refused to connect”. Using the IP address gave a similar error: “127.0.0.1 refused to connect”. The problem started a few weeks ago, but I didn't have time to troubleshoot it until today.

It worked a month ago, so what changed? Well, I only use my localhost server to host a DokuWiki (DW) wiki that I use for my personal KB. I recently migrated that local version to this blog. After tweaking the online version, I synced it to localhost. I did that for both testing and offline purposes. Now that newly-synced version doesn't work.

Things I tried

Run this command

sudo service apache2 status

tom /var/log/apache2 $ sudo service apache2 status
[sudo] password for tom: 
 apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-01-11 13:59:54 EST; 28min ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 6428 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 6444 (/usr/sbin/apach)
    Tasks: 6 (limit: 4915)
   Memory: 14.3M
   CGroup: /system.slice/apache2.service
           ├─6444 /usr/sbin/apache2 -k start
           ├─6464 /usr/sbin/apache2 -k start
           ├─6465 /usr/sbin/apache2 -k start
           ├─6466 /usr/sbin/apache2 -k start
           ├─6467 /usr/sbin/apache2 -k start
           └─6468 /usr/sbin/apache2 -k start

Jan 11 13:59:54 DellLaptop systemd[1]: Starting The Apache HTTP Server...
Jan 11 13:59:54 DellLaptop systemd[1]: Started The Apache HTTP Server.

The service is running, so try something else.

Run this command:

sudo ufw disable

Connecting to localhost still gives the same error, so let's try something else.

Run this command:

a2query -s

tom /var/log/apache2 $ a2query -s
000-default (enabled by site administrator)

That didn't help, so try something else.

First of all, where is the Apache log? To find out, run this command:

grep ErrorLog /etc/apache2/apache2.conf

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
ErrorLog ${APACHE_LOG_DIR}/error.log

Well, that didn't help much. What does ${APACHE_LOG_DIR} point to? To find out, run this command:

grep APACHE_LOG_DIR /etc/apache2/envvars

My Lubuntu Linux system returned this:

export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

Since I only have one Apache site, $SUFFIX (in the returned value) is empty. So my log directory is: /var/log/apache2.

OK, let's check the log:

tom ~ $ tail -15 /var/log/apache2/error.log
[Sat Jan 11 13:29:59.543481 2020] [mpm_prefork:notice] [pid 30745] AH00169: caught SIGTERM, shutting down
[Sat Jan 11 13:29:59.720493 2020] [mpm_prefork:notice] [pid 1385] AH00163: Apache/2.4.38 (Ubuntu) mod_apreq2-20090110/2.8.0 mod_perl/2.0.10 Perl/v5.28.1 configured -- resuming normal operations
[Sat Jan 11 13:29:59.720598 2020] [core:notice] [pid 1385] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 11 13:40:54.149537 2020] [mpm_prefork:notice] [pid 1385] AH00169: caught SIGTERM, shutting down
[Sat Jan 11 13:40:54.318890 2020] [mpm_prefork:notice] [pid 3266] AH00163: Apache/2.4.38 (Ubuntu) mod_apreq2-20090110/2.8.0 mod_perl/2.0.10 Perl/v5.28.1 configured -- resuming normal operations
[Sat Jan 11 13:40:54.318993 2020] [core:notice] [pid 3266] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 11 13:44:29.498953 2020] [mpm_prefork:notice] [pid 3266] AH00169: caught SIGTERM, shutting down
[Sat Jan 11 13:44:29.664837 2020] [mpm_prefork:notice] [pid 3674] AH00163: Apache/2.4.38 (Ubuntu) mod_apreq2-20090110/2.8.0 mod_perl/2.0.10 Perl/v5.28.1 configured -- resuming normal operations
[Sat Jan 11 13:44:29.664928 2020] [core:notice] [pid 3674] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 11 13:46:00.914742 2020] [mpm_prefork:notice] [pid 3674] AH00169: caught SIGTERM, shutting down
[Sat Jan 11 13:46:01.076607 2020] [mpm_prefork:notice] [pid 3747] AH00163: Apache/2.4.38 (Ubuntu) mod_apreq2-20090110/2.8.0 mod_perl/2.0.10 Perl/v5.28.1 configured -- resuming normal operations
[Sat Jan 11 13:46:01.076705 2020] [core:notice] [pid 3747] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 11 13:59:54.047966 2020] [mpm_prefork:notice] [pid 3747] AH00169: caught SIGTERM, shutting down
[Sat Jan 11 13:59:54.207686 2020] [mpm_prefork:notice] [pid 6444] AH00163: Apache/2.4.38 (Ubuntu) OpenSSL/1.1.1b mod_apreq2-20090110/2.8.0 mod_perl/2.0.10 Perl/v5.28.1 configured -- resuming normal operations
[Sat Jan 11 13:59:54.207784 2020] [core:notice] [pid 6444] AH00094: Command line: '/usr/sbin/apache2'

Again, that didn't help. The only “errors” in the error log are about stopping and starting the service.

More details coming soon.

Enter your comment. Wiki syntax is allowed:
O T E H Q
 
  • blog/apache/apache_troubleshooting.txt
  • Last modified: 2020/01/26 07:14
  • by tom