3

I have installed apache2 on my local machine (ubuntu 14.04). I am able to see this screen ("It Works!" screen) by using my network IP (xxx.xxx.xxx.xxx) but not using localhost or 127.0.0.1:

this

Can anybody help me out please?

EDIT:

Here is my sudo gedit /etc/apache2/ports.conf file.

I have 000-default file instead of 000-default.conf. Here /etc/apache2/sites-enabled/000-default is.

muru
  • 197,895
  • 55
  • 485
  • 740
RAJ ...
  • 173
  • 2
  • 2
  • 9

2 Answers2

5

Run this command to edit ports.conf file sudo gedit /etc/apache2/ports.conf

Add below line in the begining of the file.

Listen 0.0.0.0:80

And make sure that /etc/apache2/sites-enabled/000-default.conf files first line is equal to below line

<VirtualHost *:80>

http://httpd.apache.org/docs/2.2/bind.html

dedunu
  • 9,186
  • After changes, tried restart and faced the error: https://gist.github.com/RajRoR/6f44d9498ae796ff0fb6 – RAJ ... Oct 09 '14 at 11:10
  • Did you edit 000-default.conf – dedunu Oct 09 '14 at 15:34
  • I have 000-default file instead of 000-default.conf. https://gist.github.com/RajRoR/f306a2e581a09b672d9a – RAJ ... Oct 09 '14 at 17:17
  • skype usually use port 80. try to kill all the skype processes killall -9 skype. and restart the apache webserver – dedunu Oct 10 '14 at 04:29
  • Strange! because I always use skype on my all machine and alongwith localhost & 127.0.0.1. Anyways, after killing skype, same problem. I appreciate your effort. Any other work around? – RAJ ... Oct 10 '14 at 05:57
  • Try these command to detect what are application currently using your localhost 80 port http://wiki.apache.org/httpd/CouldNotBindToAddress – dedunu Oct 11 '14 at 04:02
  • Here is the output of sudo lsof -i:80 https://gist.github.com/RajRoR/d816991336b942b8af85 – RAJ ... Oct 13 '14 at 05:47
  • This saved me because I'v historically for some reason actually changed the default port x) – jave.web Aug 23 '21 at 21:16
1

According to my testing, I have successfully open http://localhost and http://IPaddress by adding the following lines into your httpd.conf file:

Listen IPAdress:80  
Listen 127.0.0.1:80

And then restart the httpd service with

systemctl restart httpd.service
pengchy
  • 111