Localhost refuses to connect after upgrading to Sierra OS I have downloaded and installed apache, php, phpmyadmin, mysql via macports. Everything was working fine before upgrading to macOS Sierra. 

After the upgrade whenever I try to access localhost I get the following error message: "This site can't be reached, localhost refused to connect." 

This is happening although my settings in the apache http.conf file remain the same. 

I am also providing the content of the hosts file 

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost


Any advice?
After updating to macOS Sierra, Apache httpd moves the old httpd.conf to httpd.conf.pre-update and place the new one. In order to work the localhost work please try the below procedure:

cd /etc/apache2/  
sudo mv httpd.conf httpd.conf-afterupdate  
sudo mv httpd.conf.pre-update httpd.conf  
sudo apachectl configtest  
sudo apachectl restart  


Then test:

curl -I -L localhost