Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 2739  / 1 Year ago, wed, february 15, 2023, 4:16:47

I have Apache/2.4.41 installed on Ubuntu 20.04 LTS. This is on a cloud VM.


The server has PHP 7.4, and PHP 7.3 installed. Phyton was deleted completely by mistake and then installed back. Then, I tried to recover as many libraries as possible. Not sure if there are still some missing.


I installed an SSL certificate from let'sencrypt. Since the installation, I've been having trouble accessing the site. Sometimes the browser says the site is unreachable. To fix it, I have to ssh the server and restart apache by using sudo service apache2 restart. After that, the site becomes reachable again.


sudo apache2ctl configtest
Syntax OK

What can be wrong with it? I don't want to lose my configutation files in case I have to reinstall apache2. It seems that I have to restart apache2 every day.


After trying solution from @Matigo, cleared error.log, and restarted apache2:


cat /var/log/apache2/error.log


[Sun Mar 07 22:38:42.177067 2021] [mpm_prefork:notice] [pid 1566] AH00169: caught SIGTERM, shutting down
[Sun Mar 07 22:38:42.264574 2021] [mpm_prefork:notice] [pid 9359] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1j configured -- resuming normal operations
[Sun Mar 07 22:38:42.264636 2021] [core:notice] [pid 9359] AH00094: Command line: '/usr/sbin/apache2'

sudo systemctl status apache2


● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-03-08 23:25:02 UTC; 14h ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 9348 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 9359 (code=exited, status=1/FAILURE)

Mar 07 22:38:42 bhub systemd[1]: Starting The Apache HTTP Server...
Mar 07 22:38:42 bhub systemd[1]: Started The Apache HTTP Server.
Mar 08 23:25:02 bhub systemd[1]: apache2.service: Main process exited, code=exited, status=1/FAILURE
Mar 08 23:25:02 bhub systemd[1]: apache2.service: Failed with result 'exit-code'.

More From » server

 Answers
7

Since after apache2 failed, restarting the service fixed the problem; I added this lines before [Install] in /lib/systemd/system/apache2.service:


# Added
Restart=on-failure
Restart=always
RestartSec=3
# Added

This fixed my problem. I hope it helps someone else with a similar problem.


[#1844] Wednesday, February 15, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eving

Total Points: 162
Total Questions: 102
Total Answers: 112

Location: Trinidad and Tobago
Member since Thu, Dec 1, 2022
1 Year ago
eving questions
Thu, Aug 11, 22, 22:42, 2 Years ago
Fri, Oct 28, 22, 23:39, 2 Years ago
Sat, May 21, 22, 04:23, 2 Years ago
Thu, Mar 30, 23, 11:31, 1 Year ago
;