1

I have Debian 9 installation (Bitnami appliance) with Moodle learning system and Lambda theme. We have https enabled. I tried to secure apache server according to best practices and the last two things I changed was adding "FileETag None" in some config files and installed apachetop to monitor web server. I suppose the apachetop installation caused this problem. When I enter the ip in the browser, I get the initial screen of apache web server, but the web page don't work.

When I try to start apache, I get this:

root@debian:/etc# sudo /opt/bitnami/ctlscript.sh start apache

Syntax OK
(98)Address already in use: AH00073: make_sock: unable to listen for 
connections on address [::]:80
(98)Address already in use: AH00073: make_sock: unable to listen for 
connections on address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
/opt/bitnami/apache2/scripts/ctl.sh : httpd could not be started
Monitored apache

I tried to search web for the solution, but I did'nt find exactly the same error message. Most answers to similar problems with binding were about killing the second apache processes, but I found only one apache2 listening. I tried this :

root@debian:/etc/apache2/sites-enabled# sudo netstat -ltnp | grep ':80'
tcp6       0      0 :::80                   :::*                    LISTEN      
475/apache2

root@debian:/etc/apache2/sites-enabled# netstat -tulpn | grep apache2
tcp6       0      0 :::80                   :::*                    LISTEN      
475/apache2

root@debian:/etc/apache2/sites-enabled# sudo netstat -ltnp | grep ':443'
root@debian:/etc/apache2/sites-enabled#

I also change the ownership of the log to www-data, but nothing changed. When I stop apache with this

root@debian:/# /opt/bitnami/ctlscript.sh status apache
apache not running
root@debian:/# netstat -tulpn | grep apache2
tcp6       0      0 :::80                   :::*                    LISTEN      
475/apache2

I can still access the "Apache2 Debian default page" when I enter ip in the browser. Is this normal?

Well, it's working now,

root@debian:/home/bitnami# ps aux | grep apache
root       462  0.0  0.4  75612  4268 ?  Ss   09:04   0:00 /usr/sbin/apache2 -k start
www-data   463  0.0  0.3 364772  4036 ?  Sl   09:04   0:00 /usr/sbin/apache2 -k start
www-data   464  0.0  0.3 364772  4036 ?  Sl   09:04   0:00 /usr/sbin/apache2 -k start
root      1179  0.0  0.0  12784   960 pts/0    S+   09:05   0:00 grep apache
root@debian:/home/bitnami# kill 462
root@debian:/home/bitnami# kill 463
bash: kill: (463) - No such process
root@debian:/home/bitnami# kill 464
bash: kill: (464) - No such process
root@debian:/home/bitnami# kill 1179
bash: kill: (1179) - No such process
root@debian:/home/bitnami# /opt/bitnami/ctlscript.sh start apache
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80
Monitored apache

I think that kill of the first process got it to work, but after server restart I get the same error message and killing the process and start apache is necessary :(

culter
  • 507
  • 2
  • 9
  • 16
  • Look like systemd start apache on boot. `systemctl status apache2.service` – mmv-ru Apr 12 '18 at 10:48
  • mmv-ru, 'apache2.service could not be found'. I also tried apache.service, apache, apache2. – culter Apr 13 '18 at 08:49
  • Try httpd service. (I don't have access to installed debian now). Anyway look like apache started on reboot in some way. May be custom nonstandard service... But i topic for separate question. – mmv-ru Apr 13 '18 at 12:35

2 Answers2

1

This is a clue.

(98)Address already in use:

This confirms what the clue suggests.

tcp6 0 0 :::80 :::* LISTEN 475/apache2

Apache is listening on port 80 already which is why the start command is failing.

Just a thought ... Perhaps it would be a good idea to stop the currently running apache before starting the new one.

user460788
  • 41
  • 1
  • I killed the running apache process with "kill -9 , but the error is the same. – culter Apr 12 '18 at 08:08
  • Did the process really die ? Did something start a new process automagically for you ? – user460788 Apr 12 '18 at 08:12
  • Yes, the process was automatically and immediately restarted with new process id – culter Apr 12 '18 at 08:13
  • Perhaps then you need to use a different method of stopping the process rather than the somewhat brutal `kill -9`. Maybe the script you are using provides a `stop` or `restart` options. – user460788 Apr 12 '18 at 08:16
  • I edited the question. Of course I can stop or restart apache with the script. Nothing helped. – culter Apr 12 '18 at 08:29
0

I would firstly try to stop Apache regularly

root@debian:/etc# sudo /opt/bitnami/ctlscript.sh stop apache

After that it is smart to see if apache was really shutted down

ps aux | grep apache

If you will see process ID with apache, try to firstly send kill signal

kill process_id

Again, list processes with ps commmand and if you see apache, kill it with SIGKILL

kill -9 process_id

Now you will either see apache still running -> it means something is restarting it and you need to find it why. Or you will not see any processes any more. If that is the case please start apache again.

root@debian:/etc# sudo /opt/bitnami/ctlscript.sh start apache

If you will get error again it means that apache is started twice. So there is probably some problem with startup script /opt/bitnami/ctlscript.sh but I really doubt that.

Once you identify if the problem is because apache is restarted automatically when you kill it or is started twice you should be able to go more deeply into an issue but I doubt that proper debugging can be done through such QA site as this one and rather would recommend experienced admin through.

Koss645
  • 101
  • 5
  • thank you, Koss. In the second step, the "ps aux | grep apache" command give me "root 11633 0.0 0.0 12784 1008 pts/1 S+ 08:55 0:00 grep apache". It's strange, that when I use only "ps aux", I'm unable to find the process in the list. When I try to kill the processID 11633, I get a message "bash: kill: (11662) - No such process" – culter Apr 12 '18 at 08:58
  • Koss, it's working now, until I restart server. Then I have to kill that process again and start apache. :( But it's fine that we know where the problem is. – culter Apr 12 '18 at 09:55
  • Hi Bitnami Engineer here. As @Koss645 mentioned, there was an Apache process running in the instance and you needed to kill it before starting the Bitnami's one. This is because you installed the non-Bitnami Apache one using the system packages and it was configured as service. You can check the installed services by running `sudo service --status-all` and disable the apache2 one by running `sudo service apache2 stop` and `sudo update-rc.d apache2 disable` – Jota Martos Apr 13 '18 at 09:10