apache2 localhost refused to connect











up vote
1
down vote

favorite












I'm installing apache2.4 on Ubuntu 16.04 with a custom cookbook in Chef. I cannot connect to localhost after a fresh converge, and I'm not having Chef modify any configuration files until I figure out why I cannot connect. I expect to see the default index.html landing page, but nothing works. I can ssh into my vagrant machine, but my browser will not load anything from the server. By the end of this I would like to have my own HTML file that I had Chef build in /var/www/html/ act as the landing page for my Apache server.



Below are a few methods I have already attempted:



I have ran wget localhost and 127.0.0.1 always outputs:



--2017-06-21 08:40:05--  http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... failed: Connection refused.


Running sudo systemctl status apache2 in my VM outputs:



Active: active (running) since Wed 2017-06-21 12:17:31 UTC; 31min ago


Running ps -ef | grep apache in my VM outputs:



root     12881     1  0 12:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 12884 12881 0 12:17 ? 00:00:01 /usr/sbin/apache2 -k start
www-data 12885 12881 0 12:17 ? 00:00:01 /usr/sbin/apache2 -k start
vagrant 13125 13109 0 13:08 pts/0 00:00:00 grep --color=auto apache


Running netstat -a | grep less in my VM returns:



Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 10.0.2.15:ssh 10.0.2.2:40222 ESTABLISHED
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 *:bootpc *:*


I have previously attempted to modify the config files in




  • /etc/apache2/apache2.conf

  • /etc/apache2/sites-enabled/000-default.conf


Lastly, I have checked permissions on /var/www and /var/www/html, and they're all 0755



All the above have lacked any form of success. Please help. Before you ask, yes I did restart the apache process after every modification to the server.










share|improve this question
























  • There's a Listen directive in your Apache configuration files. What does it say? My guess is, that Apache is listening to IPv6 only. What's your output of sysctl net.ipv6.bindv6only?
    – byteborg
    Jun 21 '17 at 14:08












  • sysctl net.ipv6.bindv6only returns net.ipv6.bindv6only = 0
    – Pat D
    Jun 21 '17 at 14:23










  • My /etc/apache2/ports.conf contains Listen 80 Also, I apologize in advance. I absolutely hate the markdown in this site.
    – Pat D
    Jun 21 '17 at 14:34










  • Clarification question: from which machine do you try the wget?
    – byteborg
    Jun 21 '17 at 17:10















up vote
1
down vote

favorite












I'm installing apache2.4 on Ubuntu 16.04 with a custom cookbook in Chef. I cannot connect to localhost after a fresh converge, and I'm not having Chef modify any configuration files until I figure out why I cannot connect. I expect to see the default index.html landing page, but nothing works. I can ssh into my vagrant machine, but my browser will not load anything from the server. By the end of this I would like to have my own HTML file that I had Chef build in /var/www/html/ act as the landing page for my Apache server.



Below are a few methods I have already attempted:



I have ran wget localhost and 127.0.0.1 always outputs:



--2017-06-21 08:40:05--  http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... failed: Connection refused.


Running sudo systemctl status apache2 in my VM outputs:



Active: active (running) since Wed 2017-06-21 12:17:31 UTC; 31min ago


Running ps -ef | grep apache in my VM outputs:



root     12881     1  0 12:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 12884 12881 0 12:17 ? 00:00:01 /usr/sbin/apache2 -k start
www-data 12885 12881 0 12:17 ? 00:00:01 /usr/sbin/apache2 -k start
vagrant 13125 13109 0 13:08 pts/0 00:00:00 grep --color=auto apache


Running netstat -a | grep less in my VM returns:



Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 10.0.2.15:ssh 10.0.2.2:40222 ESTABLISHED
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 *:bootpc *:*


I have previously attempted to modify the config files in




  • /etc/apache2/apache2.conf

  • /etc/apache2/sites-enabled/000-default.conf


Lastly, I have checked permissions on /var/www and /var/www/html, and they're all 0755



All the above have lacked any form of success. Please help. Before you ask, yes I did restart the apache process after every modification to the server.










share|improve this question
























  • There's a Listen directive in your Apache configuration files. What does it say? My guess is, that Apache is listening to IPv6 only. What's your output of sysctl net.ipv6.bindv6only?
    – byteborg
    Jun 21 '17 at 14:08












  • sysctl net.ipv6.bindv6only returns net.ipv6.bindv6only = 0
    – Pat D
    Jun 21 '17 at 14:23










  • My /etc/apache2/ports.conf contains Listen 80 Also, I apologize in advance. I absolutely hate the markdown in this site.
    – Pat D
    Jun 21 '17 at 14:34










  • Clarification question: from which machine do you try the wget?
    – byteborg
    Jun 21 '17 at 17:10













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm installing apache2.4 on Ubuntu 16.04 with a custom cookbook in Chef. I cannot connect to localhost after a fresh converge, and I'm not having Chef modify any configuration files until I figure out why I cannot connect. I expect to see the default index.html landing page, but nothing works. I can ssh into my vagrant machine, but my browser will not load anything from the server. By the end of this I would like to have my own HTML file that I had Chef build in /var/www/html/ act as the landing page for my Apache server.



Below are a few methods I have already attempted:



I have ran wget localhost and 127.0.0.1 always outputs:



--2017-06-21 08:40:05--  http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... failed: Connection refused.


Running sudo systemctl status apache2 in my VM outputs:



Active: active (running) since Wed 2017-06-21 12:17:31 UTC; 31min ago


Running ps -ef | grep apache in my VM outputs:



root     12881     1  0 12:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 12884 12881 0 12:17 ? 00:00:01 /usr/sbin/apache2 -k start
www-data 12885 12881 0 12:17 ? 00:00:01 /usr/sbin/apache2 -k start
vagrant 13125 13109 0 13:08 pts/0 00:00:00 grep --color=auto apache


Running netstat -a | grep less in my VM returns:



Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 10.0.2.15:ssh 10.0.2.2:40222 ESTABLISHED
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 *:bootpc *:*


I have previously attempted to modify the config files in




  • /etc/apache2/apache2.conf

  • /etc/apache2/sites-enabled/000-default.conf


Lastly, I have checked permissions on /var/www and /var/www/html, and they're all 0755



All the above have lacked any form of success. Please help. Before you ask, yes I did restart the apache process after every modification to the server.










share|improve this question















I'm installing apache2.4 on Ubuntu 16.04 with a custom cookbook in Chef. I cannot connect to localhost after a fresh converge, and I'm not having Chef modify any configuration files until I figure out why I cannot connect. I expect to see the default index.html landing page, but nothing works. I can ssh into my vagrant machine, but my browser will not load anything from the server. By the end of this I would like to have my own HTML file that I had Chef build in /var/www/html/ act as the landing page for my Apache server.



Below are a few methods I have already attempted:



I have ran wget localhost and 127.0.0.1 always outputs:



--2017-06-21 08:40:05--  http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... failed: Connection refused.


Running sudo systemctl status apache2 in my VM outputs:



Active: active (running) since Wed 2017-06-21 12:17:31 UTC; 31min ago


Running ps -ef | grep apache in my VM outputs:



root     12881     1  0 12:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 12884 12881 0 12:17 ? 00:00:01 /usr/sbin/apache2 -k start
www-data 12885 12881 0 12:17 ? 00:00:01 /usr/sbin/apache2 -k start
vagrant 13125 13109 0 13:08 pts/0 00:00:00 grep --color=auto apache


Running netstat -a | grep less in my VM returns:



Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 10.0.2.15:ssh 10.0.2.2:40222 ESTABLISHED
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 *:bootpc *:*


I have previously attempted to modify the config files in




  • /etc/apache2/apache2.conf

  • /etc/apache2/sites-enabled/000-default.conf


Lastly, I have checked permissions on /var/www and /var/www/html, and they're all 0755



All the above have lacked any form of success. Please help. Before you ask, yes I did restart the apache process after every modification to the server.







server apache2 chef






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 21 '17 at 14:28









pa4080

12.9k52460




12.9k52460










asked Jun 21 '17 at 13:50









Pat D

612




612












  • There's a Listen directive in your Apache configuration files. What does it say? My guess is, that Apache is listening to IPv6 only. What's your output of sysctl net.ipv6.bindv6only?
    – byteborg
    Jun 21 '17 at 14:08












  • sysctl net.ipv6.bindv6only returns net.ipv6.bindv6only = 0
    – Pat D
    Jun 21 '17 at 14:23










  • My /etc/apache2/ports.conf contains Listen 80 Also, I apologize in advance. I absolutely hate the markdown in this site.
    – Pat D
    Jun 21 '17 at 14:34










  • Clarification question: from which machine do you try the wget?
    – byteborg
    Jun 21 '17 at 17:10


















  • There's a Listen directive in your Apache configuration files. What does it say? My guess is, that Apache is listening to IPv6 only. What's your output of sysctl net.ipv6.bindv6only?
    – byteborg
    Jun 21 '17 at 14:08












  • sysctl net.ipv6.bindv6only returns net.ipv6.bindv6only = 0
    – Pat D
    Jun 21 '17 at 14:23










  • My /etc/apache2/ports.conf contains Listen 80 Also, I apologize in advance. I absolutely hate the markdown in this site.
    – Pat D
    Jun 21 '17 at 14:34










  • Clarification question: from which machine do you try the wget?
    – byteborg
    Jun 21 '17 at 17:10
















There's a Listen directive in your Apache configuration files. What does it say? My guess is, that Apache is listening to IPv6 only. What's your output of sysctl net.ipv6.bindv6only?
– byteborg
Jun 21 '17 at 14:08






There's a Listen directive in your Apache configuration files. What does it say? My guess is, that Apache is listening to IPv6 only. What's your output of sysctl net.ipv6.bindv6only?
– byteborg
Jun 21 '17 at 14:08














sysctl net.ipv6.bindv6only returns net.ipv6.bindv6only = 0
– Pat D
Jun 21 '17 at 14:23




sysctl net.ipv6.bindv6only returns net.ipv6.bindv6only = 0
– Pat D
Jun 21 '17 at 14:23












My /etc/apache2/ports.conf contains Listen 80 Also, I apologize in advance. I absolutely hate the markdown in this site.
– Pat D
Jun 21 '17 at 14:34




My /etc/apache2/ports.conf contains Listen 80 Also, I apologize in advance. I absolutely hate the markdown in this site.
– Pat D
Jun 21 '17 at 14:34












Clarification question: from which machine do you try the wget?
– byteborg
Jun 21 '17 at 17:10




Clarification question: from which machine do you try the wget?
– byteborg
Jun 21 '17 at 17:10










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Change the Listen 80in your /etc/apache2/ports.conf file to Listen 0.0.0.0:80 and it should bind to an IPv4 socket. Nevertheless, Apache will no longer be reachable via IPv6 in this case.






share|improve this answer























  • Sadly that didn't work either. Still receiving the same connection error.
    – Pat D
    Jun 21 '17 at 16:53











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',
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f927754%2fapache2-localhost-refused-to-connect%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Change the Listen 80in your /etc/apache2/ports.conf file to Listen 0.0.0.0:80 and it should bind to an IPv4 socket. Nevertheless, Apache will no longer be reachable via IPv6 in this case.






share|improve this answer























  • Sadly that didn't work either. Still receiving the same connection error.
    – Pat D
    Jun 21 '17 at 16:53















up vote
0
down vote













Change the Listen 80in your /etc/apache2/ports.conf file to Listen 0.0.0.0:80 and it should bind to an IPv4 socket. Nevertheless, Apache will no longer be reachable via IPv6 in this case.






share|improve this answer























  • Sadly that didn't work either. Still receiving the same connection error.
    – Pat D
    Jun 21 '17 at 16:53













up vote
0
down vote










up vote
0
down vote









Change the Listen 80in your /etc/apache2/ports.conf file to Listen 0.0.0.0:80 and it should bind to an IPv4 socket. Nevertheless, Apache will no longer be reachable via IPv6 in this case.






share|improve this answer














Change the Listen 80in your /etc/apache2/ports.conf file to Listen 0.0.0.0:80 and it should bind to an IPv4 socket. Nevertheless, Apache will no longer be reachable via IPv6 in this case.







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 20 at 9:45









terdon

63.4k12133210




63.4k12133210










answered Jun 21 '17 at 14:56









byteborg

67165




67165












  • Sadly that didn't work either. Still receiving the same connection error.
    – Pat D
    Jun 21 '17 at 16:53


















  • Sadly that didn't work either. Still receiving the same connection error.
    – Pat D
    Jun 21 '17 at 16:53
















Sadly that didn't work either. Still receiving the same connection error.
– Pat D
Jun 21 '17 at 16:53




Sadly that didn't work either. Still receiving the same connection error.
– Pat D
Jun 21 '17 at 16:53


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f927754%2fapache2-localhost-refused-to-connect%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕