Debian/Apache2 doen't start and stays in inactive mode - apache

VPS, Debian
After purging and reinstalling Apache2 through apt-get install apache2, it does not start. After starting service apache2 start, it does not give any message. systemctl status apache2 gives the following:
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Drop-In: /lib/systemd/system/apache2.service.d
└─forking.conf
Active: inactive (dead) since Su 2016-10-16 23:24:07 KRAT; 14min ago
Process: 1953 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 1947 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
there is nothing hanging on port 80. simple http-servers (by Python eg) work ok.
there is nothing in log - all files are empty.
How to make apache work?

I've found the answer. thanx for your attention. For that here is what i did for solving this.
What I have done
I've found that I do not have /usr/sbin/apache2 AT ALL. Have no idea, how it's happend. sudo apachectl configtest told me about it.
Took /usr/sbin/apache2 from backup. surely I could reinstall it from apt-get.
After that, doing sudo apachectl configtest, I've found a message like that:
apache2: Syntax error on line 140 of /etc/apache2/apache2.conf:
Syntax error on line 2 of /etc/apache2/mods-enabled/access_compat.load:
Cannot load /usr/lib/apache2/modules/mod_access_compat.so into server:
/usr/lib/apache2/modules/mod_access_compat.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
it was cured by sudo apt-get --reinstall install apache2-bin
that's all. thank you

Solved:
$ sudo apt-get update
$ sudo apt-get install apache2
Source: https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-16-04

Related

How do I check the apache config for validity in Red Hat Linux?

My operating system is Red Hat Enterprise Linux 7. This isn't working...
# httpd -t
bash: httpd: command not found
In case it helps, this is the command I run to restart apache on this box...
# systemctl restart httpd24-httpd
But this doesn't work...
# httpd24-httpd -t
bash: httpd24-httpd: command not found
This doesn't work either...
# apachectl -t
bash: apachetl: command not found
Nor does this work...
# apachectl configtest
bash: apachetl: command not found
I know this is a couple months old but ended up here. I ran into the same issue initially, hence why I am here. I found that the location for the new httpd24-httpd wasn't in my env path to execute. While I could added it there, I found the command location and was able to execute.
How I found the command:
sudo find / -name apachectl
The output of the command:
/opt/rh/httpd24/root/usr/sbin/apachectl
Executed the command:
sudo /opt/rh/httpd24/root/usr/sbin/apachectl
Turns out I have to fix my configuration.
httpd: Syntax error on line 56 of /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf: Syntax error on line 40 of /opt/rh/httpd24/root/etc/httpd/conf.modules.d/00-base.conf: Cannot load modules/mod_http2.so into server: libnghttp2-httpd24.so.14: cannot open shared object file: No such file or directory
Interesting that this came up for me, as I've not done anything with the configuration in this regard.
Here's the version I am running.
sudo /opt/rh/httpd24/root/usr/sbin/apachectl -v
Server version: Apache/2.4.34 (Red Hat)
Server built: Mar 17 2020 09:34:59
All the best!
Found something more for this as well from an old bug submitted to Redhat
Bug 1329639
Comment 10
scl enable httpd24 -- /opt/rh/httpd24/root/usr/sbin/apachectl configtest

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service"

I am trying to install Devstack but it stopping in the middle
Currently trying to install openstack, but the long process of individual installation, so am using devstack, however i already install OSM release 5. I just need a vim to put the images. Anyway I am installing openstack using devstack. But it's stopping in the middle . This was the error i am getting,
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 644 /usr/lib/apache2/modules/mod_proxy_uwsgi.so
+lib/apache:install_apache_uwsgi:102 popd
~/devstack
+lib/apache:install_apache_uwsgi:104 sudo rm -rf /tmp/tmp.EgMQRfNaCS
+lib/apache:install_apache_uwsgi:106 is_ubuntu
+functions-common:is_ubuntu:466 [[ -z deb ]]
+functions-common:is_ubuntu:469 '[' deb = deb ']'
+lib/apache:install_apache_uwsgi:108 sudo a2enmod proxy
Module proxy already enabled
+lib/apache:install_apache_uwsgi:109 sudo a2enmod proxy_uwsgi
Considering dependency proxy for proxy_uwsgi:
Module proxy already enabled
Module proxy_uwsgi already enabled
+lib/apache:install_apache_uwsgi:115 restart_apache_server
+lib/apache:restart_apache_server:231 restart_service apache2
+functions-common:restart_service:2393 '[' -x /bin/systemctl ']'
+functions-common:restart_service:2394 sudo /bin/systemctl restart apache2
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
+functions-common:restart_service:1 exit_trap
+./stack.sh:exit_trap:521 local r=1
++./stack.sh:exit_trap:522 jobs -p
+./stack.sh:exit_trap:522 jobs=
+./stack.sh:exit_trap:525 [[ -n '' ]]
+./stack.sh:exit_trap:531 '[' -f '' ']'
+./stack.sh:exit_trap:536 kill_spinner
+./stack.sh:kill_spinner:417 '[' '!' -z '' ']'
+./stack.sh:exit_trap:538 [[ 1 -ne 0 ]]
+./stack.sh:exit_trap:539 echo 'Error on exit'
Error on exit
+./stack.sh:exit_trap:541 type -p generate-subunit
+./stack.sh:exit_trap:542 generate-subunit 1559639730 82 fail
+./stack.sh:exit_trap:544 [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:547 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs
World dumping... see /opt/stack/logs/worlddump-2019-06-04-091653.txt for details
+./stack.sh:exit_trap:556 exit 1
)
Upon running apache restart, its gives this.
stack#bozz-feedz:/etc/apache2$ sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for deta
So i tried to kill all pids then it's ok for once, after that it comes back up
stack#bozz-feedz:/etc/apache2$ systemctl status apache2.service
● 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: failed (Result: exit-code) since ti 2019-06-04 12:48:10 EEST; 3min 47s ago
Docs: man:systemd-sysv-generator(8)
Process: 2339 ExecStop=/etc/init.d/apache2 stop (code=exited, status=1/FAILURE)
Process: 2314 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
stack#bozz-feedz:/etc/apache2$ sudo service apache2 restart
stack#bozz-feedz:/etc/apache2$ sudo service apache2 restart
stack#bozz-feedz:/etc/apache2$ sudo service apache2 restart
stack#bozz-feedz:/etc/apache2$ sudo service apache2 restart
stack#bozz-feedz:/etc/apache2$ sudo service apache2 restart
stack#bozz-feedz:/etc/apache2$ systemctl status apache2.service
● 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 ti 2019-06-04 12:52:15 EEST; 1s ago
Docs: man:systemd-sysv-generator(8)
Process: 10597 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 10555 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
stack#bozz-feedz:/etc/apache2$ sudo service apache2 restart
Then after some seconds the error comes back. H
stack#bozz-feedz:/etc/apache2$ sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
stack#bozz-feedz:/etc/apache2$ systemctl status apache2.service
● 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: failed (Result: exit-code) since ti 2019-06-04 12:53:29 EEST; 10s ago
Docs: man:systemd-sysv-generator(8)
Process: 13707 ExecStop=/etc/init.d/apache2 stop (code=exited, status=1/FAILURE)
Process: 13680 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
stack#bozz-feedz:/etc/apache2$
$)
Except i kill the pids again. I don't understand why this is happening.
I expect the devstack to install completely. It's just tiring
Try to reinstall apache2.
It worked for me.
sudo apt-get reinstall apache2

error apache2.service" and "journalctl -xe"

Last time I try add new domain on localhost and I leave it on few weeks so now I try run my apache this command /etc/init.d/apache2 start and I get error
[....] Starting apache2 (via systemctl): apache2.serviceJob for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.
failed!
If i tried to do reinstall apache2 but it is still not work.
I just did these two lines.It worked.
Two web servers cannot be active on the one port at the same time
this code for apache & nginx:
or
if error journalctl -xe used this code
sudo apt-get install psmisc
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill
Virtual Host configuration might cause this error
I solved this same problem by configuring my virtual host .conf files properly.
I created a virtual host & then removed the exapmle.conf file form /etc/apache2/sites-avalable/ but I didn't deleted the examle.conf file from /etc/apache2/sites-enabled/ for this reason i was getting this error.
Then I removed the example.conf file from both the folders( ../sites-enabled & ../sites-available ) and solved this issue.
If you tried to setup any virtual host recently, then try this solution.
Best of Luck
Kill the running process on the port. Hope it will work!
sudo apt-get install psmisc
sudo fuser 80/tcp
sudo lsof -i tcp:80
sudo lsof -i tcp:80 -s tcp:listen
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill
Go
sudo nano /etc/apache2/apache2.conf
remove this line:
Include /etc/phpmyadmin/apache.conf
Then
service apache2 start/restart
This problem may be a result of some configuration files in apache missing. One of the solutions would be to purge the apache2 file.
You can type:
sudo apt-get purge apache2
Then reinstall apache2 by typing:
sudo apt-get install apache2
As stated in the error message, we just have to execute :
systemctl status apache2.service
or
journalctl -xe
And you will have more detail about the error (line of the error, or command misspelled, or module not included in the configuration, ...) :
for example you can have following detail Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration ==> you then need to execute a2enmod ssl, and then execute service apache2 restart
Also I notice a difference between service apache2 reload and service apache2 restart commands. In case of persisting errors you should execute service apache2 restart, and then execute journalctl -xe.
You type
sudo netstat -pant
You check are you using port 80. If used, `
sudo service 'service_name' stop
and
sudo service apache2 start
The problem is because some configuration files are deleted.
You can use the following command to replace configuration files that have been deleted, without purging the package:
sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
execute sudo service apache2 status and check the result. it might be trying to bind to a port that is already in use

Rabbitmq: Loaded: not-found; Active: inactive (dead)

I'm trying to start the rabbitmq-server using:
me#me:~$ sudo invoke-rc.d rabbitmq-server start
...and when I try to check if it is running I get:
me#me:~$ sudo systemctl status rabbit-mq-server
● rabbit-mq-server.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
What is the missing file or directory?
Alright, well...I feel really dumb.
me#me:~$ sudo systemctl status rabbit-mq-server
Should have been:
me#me:~$ sudo systemctl status rabbitmq-server

Error with rabbit-mq server

I am trying to setup OpenStack on Ubuntu 12.04 using devstack. Now, the error I am getting is:
Setting up rabbitmq-server (2.7.1-0ubuntu4) ...
Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err}
rabbitmq-server.
invoke-rc.d: initscript rabbitmq-server, action "start" failed.
dpkg: error processing rabbitmq-server (--configure):
subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
rabbitmq-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
++ err_trap
++ local r=100
++ set +o xtrace
stack.sh failed
Any idea why am I getting this error?
I had this issue twice, when either hostname or ip address in the hosts file didn't match.
Therefore, check that you provide the correct ip address and hostname in the /etc/hosts file
Run sudo cat /etc/hostname to see your hostname
Output:
yoursite
Run sudo nano /etc/hosts
File contains:
127.0.0.1 yoursite
As you see from cat /etc/hostname, hostname is the same as in the /etc/hosts:
Run sudo rabbitmq-server start to start the rabbitmq-server
Try deleting the folder /var/lib/rabbitmq and re-running ./stack.sh
If that doesn't work either, run the following after stach.sh fails:
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq
chown -R rabbitmq:rabbitmq /var/log/rabbitmq
service rabbitmq-server restart
and check the status of rabbitmq using "rabbitmqctl status"
Similar thing happen to me. Rabbit depends on being able to resolve a hostname, run this:
echo "127.0.0.1 $(hostname -s)" | sudo tee -a /etc/hosts
This way works for me.
First go to
sudo vim /etc/hosts
and set
127.0.0.1 <hostname>
then open firewall
sudo rabbitmq-plugins enable rabbitmq_management
sudo service rabbitmq-server restart
For a clean environment, this will not happen. You must run devstack for several times, and one of them failed but you didn't get it cleaned.
run command pf -ef | grep rabbitmq, kill all rabbitmq processes. then it would be fine to run ./stack.sh
it is highly recommended to run ./unstack.sh && ./clean.sh before ./stack.sh
Just to be sure, take a look to your local network
ip add
If there's no lo network, then you should enable it:
ifconfig lo up
Then restart the server again and let's see if it works again now
systemctl start rabbitmq-server
I had the same problem though my /etc/hosts and DNS were OK. I suspect that SystemV init script was started too early when the network was not ready yet. I rewrote the startup script to systemd on CentOS 7.8 and it seems to work well now.
[Unit]
Description=RabbitMQ
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
RuntimeDirectory=rabbitmq
PrivateTmp=true
Restart=on-failure
RestartSec=10
WorkingDirectory=/opt/data/rabbitmq/
User=rabbitmq
Group=rabbitmq
ExecStart=/opt/app/rabbitmq/default/sbin/rabbitmq-server
ExecStop=/opt/app/rabbitmq/default/sbin/rabbitmqctl stop
ExecStop=/bin/sh -c "while ps -p $MAINPID >/dev/null 2>&1; do sleep 1; done"
StandardOutput=journal
StandardError=inherit
[Install]
WantedBy=multi-user.target