Im a web developer and im new in Ubuntu, I have days trying to install apache2 to work with php. But I always get this error starting Apache2:
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Mon 2019-08-26 01:23:22 CDT; 29ms ago
Process: 8725 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: no listening sockets available, shutting down
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: AH00015: Unable to open logs
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: Action 'start' failed.
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: The Apache error log may have more information.
ago 26 01:23:22 alejandro-TP201SA systemd[1]: apache2.service: Control process exited, code=exited status=1
ago 26 01:23:22 alejandro-TP201SA systemd[1]: apache2.service: Failed with result 'exit-code'.
ago 26 01:23:22 alejandro-TP201SA systemd[1]: Failed to start The Apache HTTP Server.
Procesando disparadores para ureadahead (0.100.0-21) ...
Procesando disparadores para systemd (237-3ubuntu10.25) ...
Procesando disparadores para man-db (2.8.3-2ubuntu0.1) ...
Procesando disparadores para ufw (0.36-0ubuntu0.18.04.1) ...
sh: 0: getcwd() failed: No such file or directory
I’ve tried to reinstall apache, but it hasn’t work for me… Does anyone know what can i do? It would be very helpful. Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
The problem is that you have another service listening on port 80 already. You can not have 2 services listening on the same port at the same time.
To find out which service is using the port you could run this command:
netstat -plant | grep 80
Then if you do not need this service you could stop it and disable it so that it does not start on boot.
After that you should be able to start Apache as normal.
Hope that this helps! Regards, Bobby
Heya,
The error you’re seeing is very clear about the core issue:
(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
These lines indicate that some other process is already listening on port 80, which is the default port for HTTP. Apache cannot start because it’s unable to bind to this port.
Here are the steps to diagnose and resolve the issue:
netstat command (or ss if netstat isn’t available) to determine which process is listening on port 80.sudo netstat -tuln | grep :80
This command will show you any process that’s listening on port 80.
ps command:ps aux | grep [PID]
Replace [PID] with the actual process ID you found.
Stop or Configure the Conflicting Service: Depending on the service that’s using port 80, you might want to either stop it or reconfigure it to use a different port.
If, for instance, it’s another instance of Apache or a different web server like Nginx, stopping it (or reconfiguring it) will likely resolve the issue.
To stop a service:
sudo systemctl stop [service-name]
Then you can start Apache.
If the issue still exists, it’s possible you need to kill the PID that is using the port:
kill -9 [PID]
Replace [PID] with the actual process ID you found and then start Apache again.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.