httpd won't start after editing etc/httpd/conf/httpd.conf - apache

I am following this below guide to install free SSL on AWS linux server using Certbot.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-2.html#letsencrypt
I have followed the instructions under "Prepare to install" till STEP 2 in the above guide. But I can't able to restart httpd after editing etc/httpd/conf/httpd.conf file as mentioned in the guide.
See the error I got below:
[ec2-user#ip-172-31-40-34 ~]$ sudo systemctl restart httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
Result of systemctl status httpd.service
[ec2-user#ip-172-31-40-34 ~]$ systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2022-03-31 06:22:10 UTC; 6min ago
Docs: man:httpd.service(8)
Process: 5145 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 5145 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
Mar 31 06:22:10 ip-172-31-40-34.eu-central-1.compute.internal systemd[1]: Sta...
Mar 31 06:22:10 ip-172-31-40-34.eu-central-1.compute.internal httpd[5145]: AH...
Mar 31 06:22:10 ip-172-31-40-34.eu-central-1.compute.internal httpd[5145]: In...
Mar 31 06:22:10 ip-172-31-40-34.eu-central-1.compute.internal systemd[1]: htt...
Mar 31 06:22:10 ip-172-31-40-34.eu-central-1.compute.internal systemd[1]: Fai...
Mar 31 06:22:10 ip-172-31-40-34.eu-central-1.compute.internal systemd[1]: Uni...
Mar 31 06:22:10 ip-172-31-40-34.eu-central-1.compute.internal systemd[1]: htt...
Hint: Some lines were ellipsized, use -l to show in full.
Result of journalctl -xe
[ec2-user#ip-172-31-40-34 ~]$ journalctl -xe
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished starting up.
--
-- The start-up result is done.
Mar 31 06:30:02 ip-172-31-40-34.eu-central-1.compute.internal systemd[1]: Starte
-- Subject: Unit session-86.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-86.scope has finished starting up.
--
-- The start-up result is done.
Mar 31 06:30:02 ip-172-31-40-34.eu-central-1.compute.internal CROND[5164]: (root
Mar 31 06:30:02 ip-172-31-40-34.eu-central-1.compute.internal systemd[1]: Remove
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished shutting down.
Mar 31 06:30:51 ip-172-31-40-34.eu-central-1.compute.internal dhclient[2878]: XM
Mar 31 06:32:41 ip-172-31-40-34.eu-central-1.compute.internal dhclient[2878]: XM
[1]+ Stopped journalctl -xe
Output of the apachectl configtest
[ec2-user#ip-172-31-40-34 httpd]$ apachectl configtest
AH00526: Syntax error on line 48 of /etc/httpd/conf/httpd.conf:
Invalid command '\xcb', perhaps misspelled or defined by a module not included in the server configuration

Related

CentOS 7 after upgrading Apache, "PREFIX/bin/apachectl -k start" works fine, but "systemctl start httpd.service" failed

I upgraded my Apache on CentOS 7 from source code build, following instruction: https://httpd.apache.org/docs/2.4/install.html#upgrading
After upgrade, when I run
/etc/httpd/bin/apachectl -k start
It works fine.
But when I run
systemctl start httpd.service
It failed. Here is the error log:
-- Unit httpd.service has begun starting up.
Aug 12 10:19:03 httpd[10289]: httpd: Syntax error on line 57 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.modules.d/00-base.conf: Cannot load modules/mod_access_compat.so into server: /etc/httpd/modules/mod_access_compat.so: undefined symbol: ap_get_useragent_host
Aug 12 10:19:03 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Aug 12 10:19:03 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Aug 12 10:19:03 systemd[1]: Unit httpd.service entered failed state.
Aug 12 10:19:03 polkitd[19802]: Unregistered Authentication Agent for unix-process:10283:3601117961 (system bus name :1.142076, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Aug 12 10:19:03 systemd[1]: httpd.service failed.
And when I check "httpd -v", it still shows the old version: "Apache/2.4.6 (CentOS)".
Maybe httpd.service is not pointing to the upgraded one, or some files permission not right. Anyone knows how to solve this?
Many thanks!

Failed to start The Apache HTTP Server after uninstalling and reinstalling apache2 on Raspbian

I uninstalled apache, php, mysql, proftpd, wordpress, cerbot and letsencrypt to get a new, fresh install of apache.
After uninstalling all packages and reinstalling apache, i got this error:
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "restart" failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2021-08-28 15:46:46 CEST; 23ms ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 10693 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Aug 28 15:46:46 raspberrypi systemd[1]: Starting The Apache HTTP Server...
Aug 28 15:46:46 raspberrypi apachectl[10693]: apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 33 of /etc/apache2/sites-enabled/000-default-le-ssl.conf: Could not open configuration file /etc/letsencrypt/options-ssl-apache.conf: No such file or directory
Aug 28 15:46:46 raspberrypi apachectl[10693]: Action 'start' failed.
Aug 28 15:46:46 raspberrypi apachectl[10693]: The Apache error log may have more information.
Aug 28 15:46:46 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Aug 28 15:46:46 raspberrypi systemd[1]: apache2.service: Failed with result 'exit-code'.
Aug 28 15:46:46 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for systemd (241-7~deb10u8+rpi1) ...
I tried to remove all apache-related packages by
sudo apt-get remove apache2
sudo apt autoremove
but this didn't work either.
You have an typing error on line 225 of file /etc/apache2/apache2.conf
I flashed a new image onto the Pi because I couldn't make it run.

Rabbitmq-server instalaltion error in ubuntu 18.04

I am trying to install rabbitmq. So I am facing issue as follow. For installation, I am using this blog
Reading package lists... Done
Building dependency tree
Reading state information... Done
rabbitmq-server is already the newest version (3.8.7-1).
The following packages were automatically installed and are no longer required:
erlang-diameter erlang-edoc erlang-erl-docgen erlang-eunit erlang-ic erlang-inviso erlang-nox erlang-odbc erlang-percept erlang-ssh libodbc1 libsctp1
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up rabbitmq-server (3.8.7-1) ...
Job for rabbitmq-server.service failed because the control process exited with error code.
See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
invoke-rc.d: initscript rabbitmq-server, action "start" failed.
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2020-08-31 17:20:23 IST; 4ms ago
Process: 6118 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 6118 (code=exited, status=1/FAILURE)
Aug 31 17:20:23 mahesh-Latitude-3500 systemd[1]: Failed to start RabbitMQ broker.
dpkg: error processing package rabbitmq-server (--configure):
installed rabbitmq-server package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
rabbitmq-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Many times I have removed all packages of rabbitmq and installed it again but nothing worked.
I tried fixing this issue with the following command as I got from other blogs.
$ sudo apt-get update --fix-missing
$ sudo dpkg --configure -a
$ sudo apt-get install -f
$ sudo apt-get install rabbitmq-server -y --fix-missing
Logs after running systemctl status rabbitmq-server.service
rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2020-08-31 17:43:11 IST; 1s ago
Process: 1878 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 1878 (code=exited, status=1/FAILURE)
And logs after running journalctl -xe
-- Unit rabbitmq-server.service has begun starting up.
Aug 31 17:44:17 mahesh-Latitude-3500 rabbitmq-server[3761]: Configuring logger redirection
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: ## ## RabbitMQ 3.8.7
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: ## ##
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: ########## Copyright (c) 2007-2020 VMware, Inc. or its affiliates.
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: ###### ##
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: ########## Licensed under the MPL 2.0. Website: https://rabbitmq.com
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: Doc guides: https://rabbitmq.com/documentation.html
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: Support: https://rabbitmq.com/contact.html
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: Tutorials: https://rabbitmq.com/getstarted.html
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: Monitoring: https://rabbitmq.com/monitoring.html
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: Logs: /var/log/rabbitmq/rabbit#mahesh-Latitude-3500.log
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: /var/log/rabbitmq/rabbit#mahesh-Latitude-3500_upgrade.log
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: Config file(s): (none)
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: Starting broker...
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: BOOT FAILED
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: ===========
Aug 31 17:44:19 mahesh-Latitude-3500 rabbitmq-server[3761]: Error during startup: {error,{could_not_start_listener,"::",5672,eaddrinuse}}
Aug 31 17:44:20 mahesh-Latitude-3500 rabbitmq-server[3761]: {"init terminating in do_boot",{error,{could_not_start_listener,"::",5672,eaddrinuse}}}
Aug 31 17:44:20 mahesh-Latitude-3500 rabbitmq-server[3761]: init terminating in do_boot ({error,{could_not_start_listener,::,5672,eaddrinuse}})
Aug 31 17:44:20 mahesh-Latitude-3500 rabbitmq-server[3761]: [1B blob data]
Aug 31 17:44:20 mahesh-Latitude-3500 rabbitmq-server[3761]: Crash dump is being written to: /var/log/rabbitmq/erl_crash.dump...done
Aug 31 17:44:20 mahesh-Latitude-3500 systemd[1]: rabbitmq-server.service: Main process exited, code=exited, status=1/FAILURE
Aug 31 17:44:20 mahesh-Latitude-3500 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
Aug 31 17:44:20 mahesh-Latitude-3500 systemd[1]: Failed to start RabbitMQ broker.
-- Subject: Unit rabbitmq-server.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit rabbitmq-server.service has failed.
--
-- The result is RESULT.
Aug 31 17:44:30 mahesh-Latitude-3500 systemd[1]: rabbitmq-server.service: Service hold-off time over, scheduling restart.
Aug 31 17:44:30 mahesh-Latitude-3500 systemd[1]: rabbitmq-server.service: Scheduled restart job, restart counter is at 179.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit rabbitmq-server.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 31 17:44:30 mahesh-Latitude-3500 systemd[1]: Stopped RabbitMQ broker.
-- Subject: Unit rabbitmq-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit rabbitmq-server.service has finished shutting down.
Aug 31 17:44:30 mahesh-Latitude-3500 systemd[1]: Starting RabbitMQ broker...
-- Subject: Unit rabbitmq-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit rabbitmq-server.service has begun starting up.
Nothing has worked. Please help.
Thanks in advance.
The problem most likely is that the port rabbitmq is trying to use is currently in use by another process.
This is stated in the output of journalctl -xe
... : Error during startup: {error,{could_not_start_listener,"::",5672,eaddrinuse}}
you can see all the ports currently in use on the machine with
$ lsof -i -P -n
or to check specifically for that port
$ lsof -i -P -n|grep 5672
so you could either kill the process using port 5672 or change the port used by rabbitmq

Can't Apache2 start erorr: Can't locate SOAP/Transport/HTTP.pm

I have a problem with apache2 start.
When I try apache start i have the message:
root#ocsi:/var/log/apache2# **systemctl start apache2.service**
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
in systemctl status apache2.service
root#ocsi:/var/log/apache2# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-06-01 07:53:07 CEST; 19s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 3142 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jun 01 07:53:07 ocsi systemd[1]: Starting The Apache HTTP Server...
Jun 01 07:53:07 ocsi apachectl[3142]: Action 'start' failed.
Jun 01 07:53:07 ocsi apachectl[3142]: The Apache error log may have more information.
Jun 01 07:53:07 ocsi systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jun 01 07:53:07 ocsi systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 01 07:53:07 ocsi systemd[1]: Failed to start The Apache HTTP Server.
in journalctl -xe
root#ocsi:/var/log/apache2# journalctl -xe
Jun 01 07:54:31 ocsi multipathd[700]: sda: add missing path
Jun 01 07:54:31 ocsi multipathd[700]: sda: failed to get udev uid: Invalid argument
Jun 01 07:54:31 ocsi multipathd[700]: sda: failed to get sysfs uid: Invalid argument
Jun 01 07:54:31 ocsi multipathd[700]: sda: failed to get sgio uid: No such file or directory
and in apache2 log is:
root#ocsi:/var/log/apache2# vi error.log
[Mon Jun 01 07:53:07.305344 2020] [perl:error] [pid 3149] Can't locate SOAP/Transport/HTTP.pm in #INC (you may need to install the SOAP::Transport::HTTP module) (#INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /etc/apache2) at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Plugins/Apache.pm line 25.\nBEGIN failed--compilation aborted at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Plugins/Apache.pm line 25.\nCompilation failed in require at (eval 16) line 1.\n
[Mon Jun 01 07:53:07.305621 2020] [perl:error] [pid 3149] Can't load Perl module Apache::Ocsinventory::Plugins::Apache for server localhost:0, exiting...
My system:
PHP Version : 7.4.3
Server version: Apache/2.4.41 (Ubuntu)
Description: Ubuntu 20.04 LTS
Ubuntu Linux 5.4.0-33-generic x86_64
How can I fix this error?
Looks like you need to install the SOAP::Lite module. That can be done by running:
$ sudo apt-get install libsoap-lite-perl
For more details, read on.
The error message is telling you that the Perl compiler can't find the module SOAP::Transport::HTTP (which is presumably used in some code used in your Apache start-up).
This module has never been part of a standard Perl distribution (you can test that by running corelist SOAP::Transport::HTTP). It, therefore, needs to be installed separately.
Perl modules are usually installed from CPAN. If you search for the module there, you'll see it's part of the SOAP-Lite distribution. Now you could install it directly from there using cpan but, given in this case, the easier approach is probably to install the pre-built package for your operating system. And that's done by running the command above.

rabbitmq-server doesn't start (status=64)

Running sudo service rabbitmq-server start results in the following output:
Job for rabbitmq-server.service failed because the control process exited with error code.
See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
systemctl status output for rabbitmq-server.service is as follows:
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-01-30 13:45:25 +08; 4s ago
Process: 32710 ExecStop=/usr/lib/rabbitmq/bin/rabbitmqctl shutdown (code=exited, status=69)
Process: 6836 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=64)
Main PID: 6836 (code=exited, status=64)
Jan 30 13:45:25 ip-172-31-1-92 systemd[1]: rabbitmq-server.service: Main process exited, code=exited, status=64/n/a
Jan 30 13:45:25 ip-172-31-1-92 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
Jan 30 13:45:25 ip-172-31-1-92 systemd[1]: Failed to start RabbitMQ broker.
Turns out the problem was I had set the environment variable RABBITMQ_CONFIG_FILE to /etc/rabbitmq/rabbitmq.config but created that file as rabbitmq.conf. The server crashed as a result trying to look for a file that didn't exist.