apache not working httpd lightsail instance lamp bitnami - apache

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

Related

Unable to start Apache - (98)Address already in use: AH00073

Recently decided to change my VM type on my Google Cloud account, but in the process of changing the VM it seems something has gone wrong as I'm now unable to start Apache as I keep getting the following error:
(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
I have tried to do the following steps:
netstat -ltnp | grep :80
This would return the following:
tcp6 0 0 :::80 :::* LISTEN 1047/apache2
Then run the following command:
sudo kill -9 1047
(1047 - pid no)
(the pid that appears on your particular instance.)
Restart Apache.
sudo service apache2 restart
But this doesn't help, i keep getting the same error. In fact if I run netstat right after killing the process, a new process with an incremental id of 1 pops up.
Also ran
grep Listen /etc/apache2/ports.conf
To see if there are multiple processes on the same port, that does not seem to be the case :-(
I'm stuck, help :-(
Mikael
Managed to sort this out in the end by changing the port for Apache, not sure what or why port 80 was taken, but I followed these steps which did the trick:
https://docs.bitnami.com/aws/apps/redmine/administration/configure-port/#http-port
Cheers,
Mika

Apache configured to listen on port 80 only but instead listening on port 8080 as well

I was not able to use port 8080 because it was apparently already used.
In order to see which program was using it, I typed the following command in my terminal (on MacOS):
sudo lsof -n -i :8080
Here's the result:
httpd is also listening on port 80, which I found out by using the following command:
sudo lsof -n -i :80 | grep LISTEN
Here's the result:
So I went to find out what this "httpd"-process was. Apparently it is basically the web server installed on my machine. The web server installed on my machine is Apache2.
Given this fact I concluded that Apache2 was apparently configured to listen on port 80 AND on port 8080.
BUT: Here's the crazy thing: I went to the folder /etc/apache2 and opened the file "httpd.conf". In the file Apache is configured to listen on port 80 only !!!
Why the hell is it also listening on port 8080 ?!
How can I make it listen on port 80 only ?

apache server not restarting in ubuntu 14.04

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

graceful restart of httpd, configured by Chef

I configured httpd with Chef via community httpd recipe.
https://github.com/chef-cookbooks/httpd
httpd_service "default" do
action [:create, :start]
end
After executing above code, sudo service httpd-default graceful gives the following error:
httpd: apr_sockaddr_info_get() failed for web01
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
httpd not running, trying to start
(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
sudo service httpd-default status says httpd is running.
How can I gracefully restart httpd manually?
My target server is CentOS 6.6.
sudo apachectl -f /etc/httpd-default/conf/httpd.conf -k graceful
this command resolved my problem.

Can't restart apache (98)Address already in use, even after I kill process

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