Show pageOld revisionsBacklinksFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== 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 [[doku>|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 ====== ===== Is the Apache service running? ===== Run this command <code bash> sudo service apache2 status </code> <html> <pre style="width: 100%; color: #000000; background-color: #cccccc"> <span style="color: #00FF00">tom</span> <span style="color: blue;">/var/log/apache2 $</span> 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: <span style="color: #00FF00;">active (running)</span> 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. </pre> </html> The service is running, so try something else. ===== Is the firewall blocking the connection? ===== Run this command: <code bash> sudo ufw disable </code> Connecting to localhost still gives the same error, so let's try something else. ===== Is localhost running? ===== Run this command: <code bash> a2query -s </code> <html> <pre style="width: 100%; background-color: #f2f2f2";> <span style="color: #00FF00;">tom</span> <span style="color: blue;">/var/log/apache2 $</span> a2query -s 000-default (enabled by site administrator) </pre> </html> That didn't help, so try something else. ===== Are there any errors in the log? ===== First of all, where is the Apache log? To find out, run this command: <code bash> grep ErrorLog /etc/apache2/apache2.conf </code> <html> <pre style="width: 100%; background-color: #f2f2f2";> # <span style="color: #ff4d4d;">ErrorLog</span>: The location of the error log file. # If you do not specify an <span style="color: #ff4d4d;">ErrorLog</span> directive within a <VirtualHost> <span style="color: #ff4d4d;">ErrorLog</span> ${APACHE_LOG_DIR}/error.log </pre> </html> Well, that didn't help much. What does **${APACHE_LOG_DIR}** point to? To find out, run this command: <code bash> grep APACHE_LOG_DIR /etc/apache2/envvars </code> My Lubuntu Linux system returned this: <html> <pre style="width: 100%; background-color: #f2f2f2";> export <span style="color: #ff4d4d;">APACHE_LOG_DIR</span>=/var/log/apache2$SUFFIX </pre> </html> 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: <html> <pre style="width: 100%; background-color: #f2f2f2";> <span style="color: #00FF00;">tom</span> <span style="color: blue;">~ $</span> 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' </pre> </html> Again, that didn't help. The only "errors" in the error log are about stopping and starting the service. More details coming soon. {{tag>wiki apache}} blog/apache/apache_troubleshooting.txt Last modified: 2020/01/26 07:14by tom Log In