Apache 2 could not bind, address already in use
I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.
*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information. [fail]
apache2
add a comment |
I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.
*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information. [fail]
apache2
1
Make sure apache is not already running when (ps -ef | grep apache). And what doessudo /etc/init.d/apache2 restartsay? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.
– Rinzwind
Feb 21 '13 at 13:55
add a comment |
I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.
*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information. [fail]
apache2
I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.
*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information. [fail]
apache2
apache2
edited Mar 30 '14 at 0:11
palacsint
1,307109
1,307109
asked Feb 21 '13 at 13:54
PattuPattu
12113
12113
1
Make sure apache is not already running when (ps -ef | grep apache). And what doessudo /etc/init.d/apache2 restartsay? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.
– Rinzwind
Feb 21 '13 at 13:55
add a comment |
1
Make sure apache is not already running when (ps -ef | grep apache). And what doessudo /etc/init.d/apache2 restartsay? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.
– Rinzwind
Feb 21 '13 at 13:55
1
1
Make sure apache is not already running when (
ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.– Rinzwind
Feb 21 '13 at 13:55
Make sure apache is not already running when (
ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.– Rinzwind
Feb 21 '13 at 13:55
add a comment |
5 Answers
5
active
oldest
votes
It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:
sudo lsof -i :80
This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).
Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.
Otherwise go with the answer from dedunumax.
add a comment |
Try sudo service apache2 start
then type
sudo service apache2 status
second command will display whether it is running or not.
add a comment |
I got this error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 foo
...
# cat /etc/apache2/sites-enabled/foo
<VirtualHost foo:80>
...
# cat /etc/apache2/ports.conf
...
NameVirtualHost *:80
Listen localhost:80
...
Changing ports.conf to the following solved the problem:
NameVirtualHost *:80
Listen 127.0.0.1:80
add a comment |
I got this as an apache error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
I commented out the ::1 entry and issued an apache restart command.
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# sudo service httpd restart
add a comment |
Some other software like Nginx might be running and using port 80.
Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.
To check if anything is already using port :80, type:
netstat -tulpn
I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f259241%2fapache-2-could-not-bind-address-already-in-use%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:
sudo lsof -i :80
This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).
Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.
Otherwise go with the answer from dedunumax.
add a comment |
It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:
sudo lsof -i :80
This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).
Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.
Otherwise go with the answer from dedunumax.
add a comment |
It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:
sudo lsof -i :80
This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).
Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.
Otherwise go with the answer from dedunumax.
It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:
sudo lsof -i :80
This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).
Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.
Otherwise go with the answer from dedunumax.
answered Feb 21 '13 at 14:13
0xC0000022L0xC0000022L
3,02353770
3,02353770
add a comment |
add a comment |
Try sudo service apache2 start
then type
sudo service apache2 status
second command will display whether it is running or not.
add a comment |
Try sudo service apache2 start
then type
sudo service apache2 status
second command will display whether it is running or not.
add a comment |
Try sudo service apache2 start
then type
sudo service apache2 status
second command will display whether it is running or not.
Try sudo service apache2 start
then type
sudo service apache2 status
second command will display whether it is running or not.
answered Feb 21 '13 at 13:58
dedunumaxdedunumax
4,64321627
4,64321627
add a comment |
add a comment |
I got this error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 foo
...
# cat /etc/apache2/sites-enabled/foo
<VirtualHost foo:80>
...
# cat /etc/apache2/ports.conf
...
NameVirtualHost *:80
Listen localhost:80
...
Changing ports.conf to the following solved the problem:
NameVirtualHost *:80
Listen 127.0.0.1:80
add a comment |
I got this error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 foo
...
# cat /etc/apache2/sites-enabled/foo
<VirtualHost foo:80>
...
# cat /etc/apache2/ports.conf
...
NameVirtualHost *:80
Listen localhost:80
...
Changing ports.conf to the following solved the problem:
NameVirtualHost *:80
Listen 127.0.0.1:80
add a comment |
I got this error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 foo
...
# cat /etc/apache2/sites-enabled/foo
<VirtualHost foo:80>
...
# cat /etc/apache2/ports.conf
...
NameVirtualHost *:80
Listen localhost:80
...
Changing ports.conf to the following solved the problem:
NameVirtualHost *:80
Listen 127.0.0.1:80
I got this error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 foo
...
# cat /etc/apache2/sites-enabled/foo
<VirtualHost foo:80>
...
# cat /etc/apache2/ports.conf
...
NameVirtualHost *:80
Listen localhost:80
...
Changing ports.conf to the following solved the problem:
NameVirtualHost *:80
Listen 127.0.0.1:80
answered Mar 30 '14 at 0:04
palacsintpalacsint
1,307109
1,307109
add a comment |
add a comment |
I got this as an apache error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
I commented out the ::1 entry and issued an apache restart command.
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# sudo service httpd restart
add a comment |
I got this as an apache error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
I commented out the ::1 entry and issued an apache restart command.
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# sudo service httpd restart
add a comment |
I got this as an apache error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
I commented out the ::1 entry and issued an apache restart command.
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# sudo service httpd restart
I got this as an apache error message with the following configuration:
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
I commented out the ::1 entry and issued an apache restart command.
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# sudo service httpd restart
answered May 3 '17 at 16:22
gregstergregster
1
1
add a comment |
add a comment |
Some other software like Nginx might be running and using port 80.
Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.
To check if anything is already using port :80, type:
netstat -tulpn
I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.
add a comment |
Some other software like Nginx might be running and using port 80.
Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.
To check if anything is already using port :80, type:
netstat -tulpn
I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.
add a comment |
Some other software like Nginx might be running and using port 80.
Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.
To check if anything is already using port :80, type:
netstat -tulpn
I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.
Some other software like Nginx might be running and using port 80.
Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.
To check if anything is already using port :80, type:
netstat -tulpn
I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.
answered Jan 30 at 21:34
Lucius VwLucius Vw
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f259241%2fapache-2-could-not-bind-address-already-in-use%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Make sure apache is not already running when (
ps -ef | grep apache). And what doessudo /etc/init.d/apache2 restartsay? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.– Rinzwind
Feb 21 '13 at 13:55