
Ubuntu/Debian: sudo systemctl status apache2ĥ. Ubuntu/Debian: sudo systemctl restart apache2ĬentOS/RHEL: sudo systemctl restart httpd To fix the issue, try restarting the Apache service using: To disable the UFW firewall on Ubuntu/Debian, open the terminal window and run: sudo ufw disableĬheck the status by running: sudo ufw statusģ. While Ubuntu and Debian distributions utilize UFW, CentOS and RHEL systems use firewalld by default. The firewall configuration tool on Linux systems varies depending on the distro. Also, make sure to turn on the firewall once you have finished working with localhost.


If localhost still refuses to connect, move on to other potential causes. Once you disable the firewall, navigate to localhost in a browser to check whether it connects. (For OS-specific instructions, see sections below.) Temporary Disable the FirewallĬheck whether the firewall settings are blocking the localhost connection by disabling the firewall temporarily. The sections below provide methods to resolve the localhost refused to connect error.
#MAMP LOCALHOST REFUSED TO CONNECT HOW TO#
How to Solve the Localhost Refused to Connect Error? The best way to do so it to test out each probable cause, starting from the most frequent ones. To solve the issue, identify the source of the error. The browser settings blocking the connection.The server being accessed from the wrong port.Localhost doesn't resolve to 127.0.0.1.

The server being blocked by the firewall.What Causes the Localhost Refused to Connect ErrorĬommon causes that result in localhost refusing to connect: ERR_CONNECTION_TIMEOUT (the server has not responded to the request and the client is still waiting for a response).ERR_CONNECTION_REFUSED (the server rejected the request for connection).The localhost refused to connect message displays one of two possible errors:
