Apache server not starting 'Address already in use' ERROR (98) - apache

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/

Related

apache not working httpd lightsail instance lamp bitnami

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

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

phpMyAdmin 500 Internal Server Error

today I built a droplet from DigitalOcean, I installed LAMP and phpMyAdmin without any problem. After that for copy my old website to my new droplet, I tried to use ftp. I used vsftpd, created a user for it, changed the ufw permissions little bit, changed some settings from vsftpd.conf and that's all. Now I am trying to access phpmyadmin but
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request....Apache/2.4.18 (Ubuntu) Server at xxx.xx.xxx.xxx Port 80
sudo service apache2 status
OUTPUT:
netstat -ln | grep -E ':80|443'
OUTPUT: tcp6 0 0 :::80 :::* LISTEN
Its hard to diagnose the exact problem from your Error, I would start with:
Check that the server is running correctly (in Ubuntu sudo service apache2 status)
Check Apache is listening on port 80 (in Ubuntu netstat -ln | grep -E ':80|443'
Make sure the phpmyadmin permissions are correct (directory and files usually needs to be owned by the web server user www-data with proper access permissions)
Check the apache virtual host file to see if you have the right Directory configuration (usually phpmyadmin will have sample values in the setup file)
If all of that does not point you in the right direction to fix the issue you will need to start looking through your logs in /var/log/apache2/ and get some more detailed error messages.
Error 500 doesn't mean Apache listening issue. you should open your log file to see what problem occurred. usually, Apache error log is located in this PATH
/var/log/apache2/error.log if you didn't specify a custom log file for your virtual host. append error from the end of file in your question.

Bash Script: Wait for apache2 graceful-stop

On Ubuntu 12.04 server, I have a bash script to gracefully stop my apache2 server, removing the content of /var/www, unzipping the new content and the start the apache again. (Everything is executed as root)
echo "Test";
cd /var;
service apache2 graceful-stop;
rm -R www/ && echo "Flush...";
unzip transfer.zip > /dev/null && echo "Flushed.";
service apache2 start;
The error I get is when apache starts again:
Test
Flush...
Flushed.
(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.
The Apache error log may have more information.
So the script doesn't wait for apache to stop.
Here what I tried so far:
I tried to wait with wait (Same error.)
service apache2 graceful-stop;
wait $!;
I tried to get the PID of apache and wait for this one (Same error)
pid=$(cat /var/run/apache2.pid)
apache2ctl graceful-stop;
wait $pid;
I tried to use apache2ctl graceful-stop instead of service apache2 graceful-stop (Same error)
What am I missing? When I use service apache2 stop, everything works fine:
* Stopping web server apache2
... waiting [ OK ]
Flush...
Flushed.
* Starting web server apache2 [ OK ]
Thanks
Edit
Here the output with the exit code of wait:
* Stopping web server apache2 [ OK ]
0
Flush...
Flushed.
* Starting web server apache2
(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.
The Apache error log may have more information.
[fail]
It seems that Apache itself recommends waiting a couple of seconds between restarts:
http://wiki.apache.org/httpd/CouldNotBindToAddress
It is actually relatively common that releasing and binding to a port is not immediate. It may take some time (up to several minutes) for the kernel to free up the closed socket. It is called Linger Time. It is also briefly discussed by some Apache documentation, see http://httpd.apache.org/docs/2.2/misc/perf-tuning.html search for "Lingering Close".
There is a very detailed answer about the issue to this question: Socket options SO_REUSEADDR and SO_REUSEPORT, how do they differ? Do they mean the same across all major operating systems?

Unable to start httpd on OS X Mavericks

I upgraded to OS X Mavericks and I am trying to start the apache web server
I am using the command
sudo apachectl start
to start the server but I get the following error
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
With AMPPS or any other app, you can run it through Terminal:
Start
$ sudo /Applications/AMPPS/apache/bin/apachectl start
Stop
$ sudo /Applications/AMPPS/apache/bin/apachectl stop
had the same thing this morning, out of the blue..
I found that running :
sudo /Applications/AMPPS/apache/bin/apachectl start
at least gave me some info :
AH00544: httpd: bad group name administration
so I typed (in terminal)
groups
to see which groups were available and found that there is no administration group but there is admin group
so I went into httpd.conf and found the user/groups config section and changed accordingly
and -surprise!- apache started!
Here is what u can do.
Make sure the server is turned on with sudo ( root ) but I assume this is going just fine since u are using sudo in your start post.
The other way to solve this is to check in your
/etc/apache2/httpd.conf
And change the listen port from 80 into 8080 or anything greater than 1024
Official Bug Fix is here, so you can manage it from UI.
Also sudo apachectl start/stop is for apache bundled with Mac OS X.
Type the whole path as suggested by Daniel above.
Have a read of this blog post
It sounds like you're not seeing the same "silent terminating" thing, but maybe you have a similar problem, that with Maveriks superfluous "Listen 80" line in another config file will now trip up apache. So check if you have a config file under /etc/apache2/users , and also check VirtualHosts which maybe configured in /etc/apache2/extra/httpd-vhosts.conf (or try temporarily disabling these)
Another service is running on the port 80.
Check the service by execute this command:
sudo lsof -i :80
Stop the service before you run start the apachectl.