Ubuntu server: Apache status show old failure information, and is running fine - apache

I am a bit puzzled about this... Apache status is showing information from 12 days ago. It's running fine and website is working. Is the status command not supposed to show current state of Apache?
# 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 Wed 2022-01-05 05:19:24 CET; 1 weeks 5 days ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 514 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jan 05 05:19:24 serverX systemd[1]: Starting The Apache HTTP Server...
Jan 05 05:19:24 serverX apachectl[532]: AH00112: Warning: DocumentRoot [/some/dir] does not exist
Jan 05 05:19:24 serverX apachectl[532]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 10.42.24.6:80
Jan 05 05:19:24 serverX apachectl[532]: no listening sockets available, shutting down
Jan 05 05:19:24 serverX apachectl[532]: AH00015: Unable to open logs
Jan 05 05:19:24 serverX apachectl[514]: Action 'start' failed.
Jan 05 05:19:24 serverX apachectl[514]: The Apache error log may have more information.
Jan 05 05:19:24 serverX systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jan 05 05:19:24 serverX systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 05 05:19:24 serverX systemd[1]: Failed to start The Apache HTTP Server.
OS: Ubuntu 20
netstat shows that port 80 is actually listening on 10.42.24.6
# netstat -tulpn | grep apache
tcp 0 0 10.42.24.6:80 0.0.0.0:* LISTEN 1557/apache2
tcp 0 0 10.42.24.6:443 0.0.0.0:* LISTEN 1557/apache2
Also Apache is logging requests to the access logs
I noticed this problem, because I am using systemctl status apache2 to check apache status in a new shell script I wrote... But the way this command is working, makes it useless.

Related

Unable to start httpd service on Centos 7 "GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject"

When trying to (re)start httpd service I get the following error:
** (pkttyagent:2574): WARNING **: 01:33:55.345: Unable to register authentication agent:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject Error registering authentication agent:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject (polkit-error-quark, 0) Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
Then
systemctl status httpd.service
sheds no light on the problem:
httpd.service - Web server Apache
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-07-22 01:33:55 BST; 26min ago
Process: 2578 ExecStart=/usr/local/apache/bin/apachectl start (code=exited, status=1/FAILURE)
Jul 22 01:33:55 server... systemd[1]: Starting Web server Apache...
Jul 22 01:33:55 server... systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 22 01:33:55 server... systemd[1]: Failed to start Web server Apache.
Jul 22 01:33:55 server... systemd[1]: Unit httpd.service entered failed state.
Jul 22 01:33:55 server... systemd[1]: httpd.service failed.
What might be causing this? Where should I look to debug?
[Thu Jul 23 05:40:44.885963 2020] [ssl:emerg] [pid 2877:tid 140514669713280] AH02565: Certificate and private key do not match
Looks like key and certificate do not match. Please check md5 of the key and cert file.
This usually happens when trying to restart a systemd service.
The workaround is as follows:
Run this as root
groupadd -g 23 nohidproc
usermod -a -G nohidproc polkitd
mount -o remount,rw,hidepid=2,gid=nohidproc /proc
systemctl restart polkit

Apache won't start in CentOS 7 due to missing SSLCertificateFile

Apache does not start after installing the web server. (CentOS 7)
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2020-03-28 12:18:22 MSK; 16ms ago
Docs: man:httpd.service(8)
Process: 30144 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 30144 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
Mar 28 12:18:22 box-40395.localdomain systemd[1]: Starting The Apache HTTP Server...
Mar 28 12:18:22 box-40395.localdomain httpd[30144]: AH00526: Syntax error on line 103 of /etc/httpd/conf.d/ssl.conf:
Mar 28 12:18:22 box-40395.localdomain httpd[30144]: SSLCertificateFile: file '/etc/pki/tls/certs/localhost.crt' does not exist or is empty
Mar 28 12:18:22 box-40395.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 28 12:18:22 box-40395.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Mar 28 12:18:22 box-40395.localdomain systemd[1]: Unit httpd.service entered failed state.
Mar 28 12:18:22 box-40395.localdomain systemd[1]: httpd.service failed.
You could try by creating a fake certificate.
In centos there is a handy script which might help
$ cd /etc/pki/tls/certs
$ sudo ./make-dummy-cert localhost.crt
This script produces a self-signed certificate and the certificate's private key.
Therefore SSLCertificateKeyFile in /etc/httpd/conf.d/ssl.conf could be commented out
SLCertificateFile /etc/pki/tls/certs/localhost.crt
# SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
Otherwise service won't start
The error message is very clear:
SSLCertificateFile: file /etc/pki/tls/certs/localhost.crt does not exist or is empty
Remove this invalid configuration or add missing/fix existing certificate file. Either way to have to fix the configuration before Apache can start.
Obtaining an SSL certificate is out of the scope for StackOverflow. There're plenty of resources on the web, you can try on ServerFault too…
When you're done, simply sudo systemctl start httpd to start Apache.

Apache2 server restart failed - Tried multiple options

I tried to restart failed and i tried multiple options, Yet i could not able to restart the apache2.
Below links i have tried for the problems and yet i could not able to restart.
https://askubuntu.com/questions/256013/apache-error-could-not-reliably-determine-the-servers-fully-qualified-domain-n
https://askubuntu.com/questions/256013/apache-error-could-not-reliably-determine-the-servers-fully-qualified-domain-n/256018
i am using ubuntu 18.04 LTS and i am hosting the openproject software.
i added the lines as they said. Yet my apache server is not starting.
my ipaddress is 192.168.1.146 (localhost) to browse openproject
Yesterday it was working and i could able to open the project from other computers.
http://192.168.1.146
it will navigate to the index page of the openproject.
awaiting your reply.
Solved:-
netstat -ltnp | grep :80
I found that nginx is running.
So i done sudo apt-get purge nginx
sudo kill -9 982
sudo service nginx stop
sudo service apache2 start
craftsilicon#OpenProject:~$ systemctl status apache2.service
apache2.service - The Apache HTTP Server Loaded: loaded
(/lib/systemd/system/apache2.service; enabled; vendor preset:
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf Active: failed (Result: exit-code) since Mon 2020-02-03 15:23:49 IST; 13s ago Process: 3461
ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILU
Feb 03 15:23:49 OpenProject apachectl[3461]: [Mon Feb 03
15:23:49.816448 2020] [ Feb 03 15:23:49 OpenProject apachectl[3461]:
(98)Address already in use: AH00072 Feb 03 15:23:49 OpenProject
apachectl[3461]: (98)Address already in use: AH00072 Feb 03 15:23:49
OpenProject apachectl[3461]: no listening sockets available, shu Feb
03 15:23:49 OpenProject apachectl[3461]: AH00015: Unable to open logs
Feb 03 15:23:49 OpenProject apachectl[3461]: Action 'start' failed.
Feb 03 15:23:49 OpenProject apachectl[3461]: The Apache error log may
have more Feb 03 15:23:49 OpenProject systemd[1]: apache2.service:
Control process exited, Feb 03 15:23:49 OpenProject systemd[1]:
apache2.service: Failed with result 'exi Feb 03 15:23:49 OpenProject
systemd[1]: Failed to start The Apache HTTP Server.
craftsilicon#OpenProject:~$ journalctl -xe
-- Unit systemd-tmpfiles-clean.service has begun starting up. Feb 03 15:24:51 OpenProject systemd[1]: Started Cleanup of Temporary
Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- Unit systemd-tmpfiles-clean.service has finished starting up.
-- The start-up result is RESULT. Feb 03 15:25:01 OpenProject CRON[3580]: pam_unix(cron:session): session opened for user root by
(uid=0 Feb 03 15:25:01 OpenProject CRON[3583]: (root) CMD (command -v
debian-sa1 > /dev/null && debian-sa1 1 Feb 03 15:25:01 OpenProject
CRON[3580]: pam_unix(cron:session): session closed for user root Feb
03 15:30:57 OpenProject systemd-resolved[606]: Using degraded feature
set (UDP) for DNS server 4.2 Feb 03 15:32:21 OpenProject
libreoffice-writer.desktop[3668]: javaldx: Could not find a Java
Runtime E Feb 03 15:32:21 OpenProject
libreoffice-writer.desktop[3668]: Please ensure that a JVM and the
package Feb 03 15:32:21 OpenProject libreoffice-writer.desktop[3668]:
is installed. Feb 03 15:32:21 OpenProject
libreoffice-writer.desktop[3668]: If it is already installed then try
remo Feb 03 15:32:21 OpenProject libreoffice-writer.desktop[3668]:
Warning: failed to read path from javald Feb 03 15:32:24 OpenProject
audit[3687]: AVC apparmor="ALLOWED" operation="open"
profile="libreoffice- Feb 03 15:32:24 OpenProject audit[3687]: AVC
apparmor="ALLOWED" operation="open" profile="libreoffice- Feb 03
15:32:24 OpenProject kernel: kauditd_printk_skb: 32 callbacks
suppressed Feb 03 15:32:24 OpenProject kernel: audit: type=1400
audit(1580724144.128:44): apparmor="ALLOWED" oper Feb 03 15:32:24
OpenProject kernel: audit: type=1400 audit(1580724144.128:45):
apparmor="ALLOWED" oper lines 3213-3235/3235 (END)

httpd service starting although it is disabled to start on reboot

I'm using RHEL 7.4 OS. I have done systemctl disable httpd.service to disable auto start of httpd. It is disabled also.
[root#clustermrfc002 ~]# systemctl is-enabled httpd
disabled.
But on reboot httpd service is starting.
Jul 28 18:02:07 clustermrfc002.novalocal systemd[1]: Starting The Apache HTTP Server...
Jul 28 18:02:08 clustermrfc002.novalocal httpd[8732]: [Sat Jul 28 18:02:08.357617 2018] [core:warn] [pid 8732] AH00117: Ignoring deprecated use
Jul 28 18:02:08 clustermrfc002.novalocal systemd[1]: Started The Apache HTTP Server.
which is causing problem in rhel 7 pacemaker cluster, below error is seen.
Jul 28 18:12:23 clustermrfc001 pengine[7420]: error: Resource MNGT_httpd_rhcdDaemon (systemd::httpd) is active on 2 nodes attempting recovery
Check the output of "chkconfig" and review its runlevel.
Or, check if any other service for HTTPD is enabled using "systemctl list-unit-files", if enabled, disable and verify
Although httpd.service is disabled to start on boot, its started by network.target as a dependency.
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting Network.
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting /etc/rc.d/rc.local Compatibility...
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting Postfix Mail Transport Agent...
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting Dynamic System Tuning Daemon...
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting PostgreSQL database server...
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting Simple Network Management Protocol (SNMP) Daemon....
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting
The Apache HTTP Server...

Apache not restarting, getting segmentation fault. Tried solutions but not working

I started my laptop after almost a month. Accessing localhost is giving me below error:
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: inactive (dead) since Mon 2017-08-21 20:13:20 GST; 1min 9s ago
Docs: man:systemd-sysv-generator(8)
Process: 11127 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 11110 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Aug 21 20:13:20 user-HP-ProBook-6470b systemd[1]: Stopped LSB: Apache2 web server.
Aug 21 20:13:20 user-HP-ProBook-6470b systemd[1]: Starting LSB: Apache2 web server...
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11110]: * Starting Apache httpd web server apache2
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11110]: Segmentation fault
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11110]: Action 'start' failed.
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11110]: The Apache error log may have more information.
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11127]: * Stopping Apache httpd web server apache2
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11127]: *
Aug 21 20:13:20 user-HP-ProBook-6470b systemd[1]: Started LSB: Apache2 web server.
I am using Ubuntu 16.04 with following Apache2 version:
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2016-07-14T12:32:26
I tried changing httpd.conf as mentioned in other articles, but that didn't helped and I still continue to get this error. Any help would be appreciated.