When I restart my instance in lightsail I get the "apache server not running". When I run the command
sudo /opt/bitnami/ctlscript.sh restart
I get this error:
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : apache not running
/opt/bitnami/php/scripts/ctl.sh : php-fpm stopped
/opt/bitnami/mysql/scripts/ctl.sh : mysql stopped
/opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306
/opt/bitnami/php/scripts/ctl.sh : php-fpm started
Syntax OK
(98)Address already in use: AH00073: make_sock: unable to listen for connections on address
[::]:443
(98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:443
no listening sockets available, shutting down
AH00015: Unable to open logs
/opt/bitnami/apache2/scripts/ctl.sh : httpd could not be started
I' m blocked, I don't know what can I do; all websites are down and I get the error ERR_SSL_PROTOCOL_ERROR when I want to redirect to all my websites.
sudo netstat -ltnp | grep ':80'
tcp6 0 0 :::80 :::* LISTEN 1584/httpd
sudo kill -9 1584
sudo /opt/bitnami/ctlscript.sh restart apache
Repeat the command until you kill all conflicting processes
I've been trying for the past few days to solve this issue in several different ways and got no results.
Below is a copy of all the last commands i ran trying to gather more info about the issue:
2019 from 181.167.101.245 bitnami#ip-172-31-2-74:~$ sudo service
apache2 restart
* Restarting web server apache2
(98)Address already in use: AH00072: make_sock: could not bind to
address [::]:8
0
(98)Address already in use: AH00072: make_sock: could not bind to
address 0.0.0.
0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information. > [fail]
* The apache2 instance did not start within 20 seconds.
Please read the log files to discover problems
bitnami#ip-172-31-2-74:~$ sudo netstat -nlp |
grep 80
tcp6 0 0 :::80 :::*
LISTEN
13456/httpd.bin unix 2 [ ACC ] SEQPACKET LISTENING 1680
402/systemd-udevd /run/udev/control
Any kind of help will be greatly appreciated and let me know if additional information is needed.
As always thanks in advance.
Bitnami Engineer here,
If you are using a Bitnami ready-to-use instance with any of our applications, they usually include Apache to serve the application. In case you perform any change in the Apache's configuration files inside the /opt/bitnami directory, you need to restart the Apache's service by using the ctlscript.sh file we provide.
sudo /opt/bitnami/ctlscript.sh
You can learn more about it here:
https://docs.bitnami.com/aws/faq/administration/control-services/
When I am trying to restart the apache2 services with sudo service apache2 restart command, I am getting this error.
(98)Address already in use: AH00072: make_sock: could not bind to
address [::]:80 (98)Address already in use: AH00072: make_sock: could
not bind to address 0.0.0.0:80 no listening sockets available,
shutting down AH00015: Unable to open logs Action 'start' failed. The
Apache error log may have more information.
So I added ServerName localhost in my apache2.conf file and then tried to restart the apache2 service. I am getting the same above error.
Please help.
There are two reasons why this problem exists:
1. Multiple ‘Listen’ Directive Entries Existing in Configuration Files. (Solution below)
Hit grep Listen /etc/apache2/ports.conf
Check if you are getting something like:
Listen 80
Listen 81
Listen 80
Listen 443
Listen 443
The error log could not bind to address 0.0.0.0:80 mentions its an issue with the port 80. Hence edit the file and remove the duplicate.
2. Another Process is Already Using Port 80
Hit : fuser -n tcp 80 along with ps aux | grep PID or hit
ss -plnt sport eq :80
and kill the processes.
You probably have a process that's still using it. You can do
pidof apache2
The last pid in the list is the main process you can kill.
or you can do
netstat -anp | grep :80 | grep -i listen
Then on the right hand side of the line, that it outputs you'll see the PID.
or you can do
lsof -i :80
Then the top apache process is the one you'll want to kill. Which is the number in the 2nd column output.
Then whenver you have the main pid from one of these commands use this.
kill -9 <pid> e.g. kill -9 12345
I'm unable to (re)start apache because port 80 is already in use:
[root#out-dev log]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using <ip> for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED]
So I tried identifying the process which was using port 80:
[root#out-dev log]# netstat -npl | grep ':80'
tcp 0 0 :::80 :::* LISTEN 3840/httpd
It's httpd! That's odd to me because the service httpd is apparently not running:
[root#out-dev log]# service httpd status
httpd is stopped
Anyway, I tried killing the process, but as soon as I do, a new process appears, taking control of port 80. And all the while, service httpd status indicates that httpd is not running.
[root#out-dev log]# kill -9 3840
[root#out-dev log]# netstat -npl | grep ':80'
tcp 0 0 :::80 :::* LISTEN 3842/httpd
Update: Already fixed, it seems that one of VirtualHosts configurations files was wrong in sites-enabled.
I have Ubuntu 11.10
When I run the command to start apache2:
sudo /etc/init.d/apache2 start
I get the following error message:
Starting web server apache2
apache2: Could not reliably determine the server's fully qualified
domain name, using 127.0.1.1 for ServerName (98)Address already in
use: make_sock: could not bind to address 0.0.0.0:80 no listening
sockets available, shutting down Unable to open logs Action 'start'
failed.
I run this command in order to get the process that is using the port 80:
sudo netstat -ltnp | grep ':80'
Which returns this output:
tcp6 0 0 :::80 :::* LISTEN 1176/
To know which process is I run this command:
ps -wlp1176
That returns:
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
5 D 33 1176 1 0 80 0 - 0 exit ? 00:00:00 apache2
But if I try to kill the process:
sudo kill -9 1176
It doesn't kill it, if I run again the netstat command still appears listening and apache start fails.
Any suggestions?
Worked for me running this command:
fuser -k -n tcp 80
It may be skype or nginx using the port 80.
Try shutting down skype, or running: sudo /etc/init.d/nginx stop
I had the same error, and just want to confirm that running
sudo netstat -ltnp | grep ':80'
helped me indicate that Hiawatha webserver was in the way of Apache2.
Removing Hiawatha fixed the issue (sudo dpkg --purge hiawatha).
Ubuntu 12.04.2 server.
I had the same problem
For me, apache was already running but it was running the wrong way.
Killing processes didnt work because a daemon kept reinstantiating it.
apachectl stop
resolved the issue.
use either
sudo killall httpd
or
sudo killall apache2
check if some one using the 80 port
sudo netstat -tulpn| grep :80
The restart
sudo service httpd start
then restart the server.It took me a whole day to understand the issue
Try this, it works for me…
sudo netstat -ltnp | grep ':80'
This would return the following:
tcp6 0 0 :::80 :::* LISTEN 1047/apache2
Then
sudo kill -9 1047
Then I was able to restart Apache and everything was working fine.
Go to device manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (and disable or manual some services depended on it).
Reboot and enjoy!
This will happen because of repeated installation of apache or port is using by another service
sudo lsof -i | grep "httpd"
You will find process id and listening port of service. Then check
cd /proc/(process id of http)
Then kill that process using command
kill -9 pid
now
sudo netstat -nltp
again kill the process
syntax:-
kill -9 pid
and now start apache
sudo ./apachectl start
It look like other process is using port 80.
$ netstat -anp | grep
eg. $ netstat -anp | grep 80
by above you get process name, if you want to use port then you need to stop the process or change the port
What I would do is simply check if the following is set in your /etc/apache2/sites-available/your-domain-name.com.conf
SSLEngine on
SSLCertificateFile /your/path/to/your-domain.com.crt
SSLCertificateKeyFile /your/path/to/your-domain.com.key
SSLCACertificateFile /your/path/to/your-domain.com.ca-bundle
and there aren't any mistyped directories or anything else that would not supposed to be in your .conf file. It did the trick for me as re-starting and killing the processes did not help at all. It did not start anyway.
I fixed it by using below procedure.
Run below command as root user.
root# ps aux |grep apache
It will show you Apache PID, just kill that PIDs and restart Apache Server.
You can only have listen PORTNUMBER in only one file of .conf. Do not put it in multiple files. Try it :)