Localhost refused to connect wamp

New Page


September 13, 2022

nadia m

8 minute read

Localhost negó a conectar el error: 5 confirmed forms of solution

Copy link


Between the different red connection errors that may have encountered the localhost has failed to connect or the error ERR_Connection_Refused .

Cuando intends to connect to an IP direction, generally intends to connect to a different computer. Without embargo, provided that localhost uses the direction of the inverted loop, connect to this means that a connection is stable with its own computer.

Es por eso que muchos usuarios, como desarrolladores y administradores de red, usan localhost para probar programs o sites que aún están en déarrollo, ya que reduce el riesgo de romper un site in vivo.

However, cuando no pueda acceder à localhost, no podrá acceder a su proyecto en un entorno local.

Hay varias causas de este error, como muestra en la following tabla:

Error code Localhost nego a conectarse
type of error Navegador/Cortafuegos
Error Variations ERR_CONNECTION_REFUSED failed to connect No access to this localhost site failed to connect.
Causes of error The server is blocked by the cortafuegos The server is ejected in an incorrect port The Apache server is not ejected correctly If necessary to reconfigure the configuration of the navegador

Además, tenga en cuenta que debe estar en su local máquina para acceder a su local host; no puede acceder a él en ningún otro dispositivo.

This article explains why the localhost error is ignored and the following methods are solved.

Download the e-book: Cree su primer sitio web en 9 sencillos pasos

  • ¿Qué es el error de Localhost que se negó a conectar?
  • How to fix Localhost se negó a conectarse – Video Tutorial
  • 5 Methods to Solve Localhost se negó a conectar Error
    • 1. Temporarily disable your firewall
    • 2. Flush your DNS
    • 3. Connect with specified port
    • 4. Make sure Apache is running
    • 5. Go through browser settings

¿Qué es el error de Localhost que se negó a conectar?

Is a common error that may occur when trabaja in local machines. The local host simulates a Web server that launches on its computer. When aparece el error “localhost se negó a conectarse”, it is probable that it is due to a badly configured port. Other areas include insufficient permissions and the Apache web server is not running properly.

How to fix Localhost se negó a conectarse – Video Tutorial

After solving localhost connection error with four easy methods in nuestro video tutorial.

youtube channel logo youtube channel logo

¡Suscríbete para more educational videos! University accommodation

subscribe subscribeSubscribe

De plus, tenga en cuenta que al intentionar acceder a localhost, puede encontrar dos posibles errores: ERR_CONNECTION_REFUSED y ERR_CONNECTION_TIMEOUT . Ambos están estrechamente relacionados pero requieren soluciones diferentes.

L’erreur localhost ERR_CONNECTION_REFUSED indique que le serveur a rejeté la tentative de connexion, tandis que ERR_CONNECTION_TIMEOUT indique que rien ne s’est passé et que le client attend toujours une réponse.

Therefore, to solve ERR_CONNECTION_REFUSED localhost issue, you need to check the firewall since it’s what rejects the data packets. You’ll also need to look at the Listen directive in the httpd.conf file and make sure it’s correctly set.

Meanwhile, to solve ERR_CONNECTION_TIMEOUT on Chrome, you’ll need to look at your connection settings because this error means the service is not running as it should or is not correctly installed.

5 Methods to Solve the Localhost Refused to Connect Error

Here are five methods to solve the localhost refused to connect error, in no particular order.

1. Temporarily Disable Your Firewall

A firewall is a security system that monitors and filters your traffic, blocking potential threats. While it’s an important tool, the detection protocols may run inaccurately sometimes.

A firewall might incorrectly block safe web pages or incoming connections. Therefore, if you’re currently developing a website and you need to access its locally-hosted version, it’s best to temporarily disable the firewall while you’re working on the site. That way, your test site won’t be blocked.

Keep in mind that once the website goes live and you no longer see the ERR_CONNECTION_REFUSED localhost problem message, re-enable your firewall immediately.

Here are the steps to disable the firewall on Mac, Windows, and Linux, respectively.

How to Disable the Firewall on Mac

  1. Navigate to System Preferences.
  2. Select Security and Privacy.

Acceso a la seguridad y privacidad de Mac a través de las preferences del system Access Mac Security & Privacy through System Preferences

  1. Select the Firewall tab to see the complete firewall settings.
  2. Click the lock icon, then enter your username and password.
  3. You’ll see a message informing you that, if you turn off the firewall, you’ll accept all incoming connections, including those that potentially carry unauthorized resources. Click the Turn off Firewall button.

Disable the cortafuegos of Mac through Seguridad y privacidad Disable Mac Firewall via Security & Privacy

  1. Click the lock to prevent further changes on this setting without your permission.

Note that the steps to disable the firewall in Mac might be slightly different depending on the version of macOS you use.

How to Disable the Firewall on Windows

There are two ways to disable the firewall on Windows 10, 8, 7, and Vista – via the control panel or command prompt.

Here are the steps to disable the firewall using the control panel:

  1. Open the control panel, then navigate to System and Security -> Windows Defender Firewall .

Access to the Windows Defender firewall through the system and security Accessing Windows Defender Firewall through System and Security

  1. Select Turn Windows Defender Firewall on or off .

Selecting Enable or Disable Windows Defender Firewall Selecting Turn Windows Defender Firewall on or off

  1. Switch off both firewalls in the private and public network settings.

Deactivation of cortafuegos in redes públicas and privadas Turning off firewalls in both private and public networks

  1. Click the OK button to apply the changes.

If the option is not clickable, it means the firewall settings are under another security program’s control. If this is the case, you might want to uninstall that app first.

Meanwhile, these steps apply to disable firewall via command prompt:

  1. Open the command prompt as an administrator.
  2. Enter the following command:

netsh advfirewall disable all profile status

How to Disable Firewall in Linux

The steps to stop and disable the firewall vary depending on your Linux distribution.

If you are using Ubuntu or Debian , your firewall should be managed by ufw . If you are using CentOS or RHEL , the default firewall management tool will be firewalld .

It is important to stop the firewall before disabling it. Otherwise, you will encounter errors during the process.

To disable the firewall on ufw, follow these steps:

  1. Stop the ufw using this command:

sudo ufw disable

  1. Once the firewall is stopped, run a command to disable the ufw service on startup.

sudo systemctl disable ufw

  1. Verify that ufw is disabled using this command:

sudo status ufw sudo status systemctl ufw

  1. Re-enable the ufw.

sudo systemctl enable ufw sudo ufw enable ## check that ufw has started ## sudo ufw status

Otherwise, here are the steps to stop and disable the firewall on firewalld:

  1. Stop the firewalld using the following command.

sudo systemctl stop firewall

  1. Disable the startup firewall using this command.

sudo systemctl disable firewall sudo systemctl mask –now firewalld

  1. Just enter this command to check if the firewall has been disabled.

sudo systemctl firewall status

  1. Run the following commands to re-enable firewalld.

sudo systemctl unmask –now firewalld sudo systemctl enable firewalld sudo systemctl start firewalld ## check that firewalld has started ## sudo firewall-cmd –state

2. Flush your DNS

The DNS cache stores data from the websites you visit, so those web pages will load faster the next time you access them.

However, if the DNS contains too many records, it may not work.

To resolve this issue, flush the DNS to clear the records:

  1. Open the command prompt by typing cmd in the search bar next to the Start menu.
  2. Enter this command:

ipconfig /flushdns

  1. Check if the problem 127.0 0.1 refused to connect is gone or not.

3. Connect with specified port

The default port number for the web server is 80. If you’re trying to access it by typing localhost in your browser – which will direct to localhost:80 – but it turns out your web server is not configured to use the default port, you’ll get the localhost error or 127.0 0.1 refused to connect message.

However, port 80 may sometimes be used by another application on your computer. For example, if Skype is currently using it, you wouldn’t be able to run the Apache server on the same port simultaneously.

To solve this problem, first, let’s check whether port 80 is free. We’re going to use XAMPP to do this.

XAMPP is a web server solution stack used to build websites offline on a local web server. It’s a cross-platform tool, so it works on Windows, Mac, and Linux. It’s commonly used to install WordPress on a local computer.

Here are the steps to check free port number on Windows and Linux – it will be slightly different on Mac.

  1. Click the Start Menu to start XAMPP.
  2. Click the Netstat button on the right side of the control panel.

Selecting the Netstat button in the XAMPP control panel for all users Selecting the Netstat button in the XAMPP Control Panel to see all used ports

  1. You’ll see all the used ports on your computer. Check whether port 80 is free or used by another application.

Lista de puertos usados ​​en Netstat List of used ports in Netstat

  1. If port 80 is already used by another application, choose a free port number, for example port 8080.

Next, let’s proceed to connect with the correct port number using the listen command.

The listen command is required to instruct Apache HTTPd to listen to only specific IP addresses or ports. If this command is not present in the config file, your server will fail to start.

Here are the steps to change Apache’s port in XAMPP:

  1. Click the Start Menu to start XAMPP.
  2. You’ll see the XAMPP icon in your taskbar’s system tray. Double click it.
  3. The XAMPP control panel window will appear. It will show a list of all currently running services.
  4. Click on the Stop button next to Apache.

Owning Apache from the XAMPP control panel Stopping Apache from XAMPP Control Panel

  1. Open File Explorer, then locate the httpd.conf file in the configuration folder. If you are using Windows, it will be in the C:\xampp\apache\conf directory . If you are using Linux, it will be in bin/apache . On Mac, the path will be Applications/XAMPP/xamppfiles/etc/httpd.conf .
  2. Open it using Notepad or any other available text editor. Then look for these lines in the file:

Listen 80 Server name localhost: 80

  1. If your port 80 is free, just make sure the port number in the Listen command matches the port number of the localhost. If another application is using port 80, replace it with an available port number. In this example, we’ll change it to port 8080 .

Listen 8080 ServerName localhost:8080

  1. Save the file. It will ask for administrative privileges, choose Yes .
  2. Open the XAMPP control panel again, then start the Apache web server.
  3. Access http://localhost:8080 or to check whether the localhost is working.

If you’re using WAMP – a solution stack for the Windows operating system – do the following steps to change the running port.

  1. Right-click the taskbar and select Task Manager .
  2. Click End Task for any instances of WAMP that are still running.
  3. Next, open file explorer and navigate to the config folder in C:\wamp\apache2\conf .
  4. Look for the HTTPD config file . Open it with a text editor like Notepad.
  5. Look for these lines in the file:

Listen 80 Server name localhost: 80

  1. If your port 80 is free, just make sure the port number in the listen command matches the port number of the localhost. If port 80 is already in use by another application, replace the number with an available port.

Listen 8080 ServerName localhost:8080

  1. Save the file.
  2. Open WAMP again to see if you still get the same error.

4. Make sure Apache is running

If your Apache web server is not running, you will not be able to access localhost.

To check the status of your Apache, the command will vary depending on the distro you are using.

Here is the command for Debian or Ubuntu:

$ sudo systemctl apache2 state

And here is the command for CentOS/RHEL/Fedora:

# status systemctl httpd

The result of this health check will indicate whether your server is running or stopped.

If it tells you that the server is down, try to fix the problem by restarting it using the following command.

For Debian and Ubuntu:

sudo systemctl restart apache2

For CentOS/RHEL/Fedora:

# systemctl restart httpd

The output of the restart command will look like this:

* Restart apache2 webserver [OK]

If the restart attempt fails, you will receive an error message. The message may vary depending on your choice of distribution, but it will fall in the following direction:

apache2: unrecognized service Could not restart apache2.service: Failed to load unit apache.service: no such file or directory.

If you see these error messages, try reinstalling the service. Once you are sure that the web server is correctly installed, restart it using the corresponding command.

5. Go through browser settings

Your browser settings can also cause the 127.0 0.1 refused to connect error because every web browser has a different setup and characteristics.

For instance, when you enter an HTTP web address, some browsers automatically redirect you to its HTTPS equivalent. However, if that site has an invalid SSL certificate or doesn’t have any, you’ll get the localhost refused to connect error message.

If you’re using Chrome browser, follow these steps:

  1. Enter chrome://net-internals/#hsts on your browser’s address bar.

Chrome HSTS configuration. Chrome's HSTS settings.

  1. Locate Delete domain security policies, then type localhost.

Elimination of policies of seguridad of dominion in localhost. Deleting domain security policies in localhost.

  1. Restart the browser.

Troubleshooting Other Errors

How to Fix Too Many Redirects Error? How to Solve HTTP 400 Error – Bad Request? How to Solve ERR_CACHE_MISS Error? How to Resolve PR_END_OF_FILE_ERROR? How to Fix Error Establishing a Database Connection in WordPress


Localhost refused to connect is a type of network connection error you might encounter when working on a project on your local web server.

It is triggered if the firewall wrongly blocks your server or you’re using the wrong port. The localhost error can also happen if your Apache web server or Chrome browser is not configured correctly.

There are five methods to solve the localhost refused to connect error:

  • Temporarily disable your firewall – Disable the firewall so it won’t flag the project on your localhost as malicious and block its access.
  • Flush DNS – Clear existing browser data.
  • Connect with specified port – Check if the running port of the Apache web server is port 80 or a particular port number specified for localhost.
  • Ensure Apache is running – Make sure the Apache web server is running and installed correctly.
  • Go through browser settings – Enable connections to sites without SSL certificate, like your test site.

We hope this article helps you solve the localhost refused to connect error.

Was this tutorial helpful?



Author Author

The author

Nadia M.

Maya is a Digital Content Writer at Hostinger. As a website development and digital marketing enthusiast, she’s keen to share her knowledge so people can thrive online. When she’s not writing, you can find her watching sci-fi movies while eating ramen.

More from Nadia M.

WAMP Server doesn’t load localhost

Ask Question

Asked 10 years, 10 months ago

Modified 5 years, 7 months ago

Viewed 164k times

Report this ad

This question shows research effort; it is useful and clear


This question does not show any research effort; it is unclear or not useful


Bookmark this question.

Show activity on this post.

I have a “small” problem with my WAMP Server. Everything worked fine (WAMP is on port 8081 – free port no matter what program I have open) yesterday but today, I can’t reach localhost:8081. It’s just keep loading and loading and loading…

I have tried everything – open the port in my router and in my firewall, check that the port is currently open and reachable (which it is) and so on. I installed the latest Windows updates to Windows 7 Ultimate 64-bit earlier this day, restarted my computer and boom – I can’t reach localhost:8081. It worked perfectly before I restarted the computer.

The updates was KB2620704, KB2588516, KB2617657, and KB890830.

Please, help me! I’m literally dying inside if I can’t work with my website. I have tried XAMPP too. Apache didn’t want to be loaded (as usual) so I uninstalled it. I have even reinstalled WAMP Server 2 times since this happened. Even run CCleaner after each uninstall so everything with WAMP was gone before I installed it again.

Thanks in advance.

  • localhost
  • wamp


Share a link to this question

Copy link CC BY-SA 3.0

Improve this question


Follow this question to receive notifications

requested on November 10, 2011 at 5:48 PM

Airikr user avatar

Airikr Airikr

5,928 14 14 gold badges 54 54 silver badges 106 106 bronze badges


  • J’ai même essayé de changer le port de 8081 à 80, 8080 ou un autre port, mais cela ne fonctionne pas de toute façon. Mon fichier hosts dans Windows ne contient que “ localhost” sans “. Aucun commentaire ou quoi que ce soit cependant, car je n’avais pas ce fichier dans Windows/System32/drivers/etc ou ailleurs, alors je l’ai créé.

    – Airikr

    12 novembre 2011 à 4:25

  • que dit le journal des erreurs ? avez-vous essayé d’obtenir un outil réseau ou quelque chose pour vérifier le type de demande que vous recevez ?

    – Livre de Zeus

    29 novembre 2011 à 3:13

  • @BookOfZeus One of (or the only) creator(s) of WAMP Server connected to my computer via TeamViewer few weeks ago and tested everything he knew can cause some problems to WAMP. Nothing worked, so I reinstalled my operating system and now everything works again.

    –  Airikr

    Nov 29, 2011 at 20:03

  • I got the solution : stackoverflow.com/questions/6246938/…

    –  badal

    Jun 5, 2013 at 17:30

Add a comment  | 

3 Answers 3

Sorted by: Reset to default

Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)

This answer is useful


This answer is not useful

Show activity on this post.

Solution(s) for this, found in the official wampserver.com forums:


This problem is caused by Windows (7) in combination with any software that also uses port 80 (like Skype or IIS (which is installed on most developer machines)). A video solution can be found here (34.500+ views, damn, this seems to be a big thing ! EDIT: The video now has ~60.000 views 😉 )

To make it short: open command line tool, type “netstat -aon” and look for any lines that end of “:80”. Note thatPID on the right side. This is the process id of the software which currently usesport 80. Press AltGr + Ctrl + Del to get into the Taskmanager. Switch to the tab where you can see all services currently running, ordered by PID. Search for that PID you just notices and stop that thing (right click). To prevent this in future, you should config the software’s port settings (skype can do that).


faites un clic gauche sur l’icône wamp dans la barre des tâches, allez dans apache > httpd.conf et éditez ce fichier : changez “listen to port…. 80” en 8080. Redémarrez. Fait !


Port 80 blocked by “Microsoft Web Deployment Service”, just uninstall it, more info here

By the way, it’s not Microsoft’s fault, it’s stupid port usage by most WAMP stacks.

IMPORTANT: you must use localhost or now with port 8080, it means or localhost:8080.

To share

Share a link to this answer

Copy link CC BY-SA 3.0

Improve this answer


Follow this answer to receive notifications

modified on October 17, 2013 at 11:19

Andrea user avatar


11.3k 17 17 gold badges 62 62 silver badges 66 66 bronze badges

answered on April 28, 2012 at 6:35 PM

Sliq user avatar

Sliq Sliq

15.1k 25 25 gold badges 105 105 silver badges 139 139 bronze badges


  • i have to add something: you can also simply deinstall the IIS software (“internet information service”) and skype via: Control Panel -> Programs and Features -> “IIS” or “Internet Information Service”

    –  Sliq

    Apr 28, 2012 at 18:38

  • 4

    I had the same problem described above and i tried the SOLUTION #2 proposed by Panique and jv42 and then i tried localhost:8080 It worked well. Thanks a lot guys.

    –  Access2020

    Nov 28, 2012 at 9:53

  • Avast Antivirus was causing my problem, thanx!

    –  mbwasi

    Feb 5, 2013 at 13:47

  • “Microsoft Web Deployment Service” Helped me. Tnx

    –  iSenne

    Sep 9, 2013 at 17:26

Add a comment  | 

Report this ad

This answer is useful


This answer is not useful

Show activity on this post.

I faced a similar problem. I tried everything with ports, hosts and config files.But nothing helped.

I checked the apache error logs. They showed the following error

(OS 10038) An operation was attempted on something that is not a socket. : AH00332: winnt_accept: getsockname error on listening socket, is IPv6 available?

Finally this solved my problem.

1) Access the command prompt and run it in administrative mode. In Windows 7 you can do this by typing cmd in run and then pressing ctrl+shift+enter

2) run the following command: netsh winsock reset

3) Reset the system

To share

Share a link to this answer

Copy link CC BY-SA 3.0

improve this respuesta


Sigue esta respuesta para recibir notifications

modified on August 16, 2015 at 8:37

FastFarm user avatar

fast farm

289 4 4 silver badges 21 21 bronze badges

answered on July 23, 2013 at 12:24

CoderP user avatar

CoderP CoderP

1,361 1 1 gold badge 13 13 silver badges 19 19 bronze badges


Add a comment | 

This answer is helpful


This answer is not helpful

View activity on this post.

Cambie el puerto 80 al puerto 8080 et reinicie all the servicios y acceda como localhost:8080/

Works well.

To share

Share a link to this answer

Copy link CC BY-SA 3.0

improve this respuesta


Sigue esta respuesta para recibir notifications

answered on March 22, 2016 at 10:44 am

Tharick user avatar

Tharick Tharick

81 7 7 bronze badges


  • 3

    Explain why in your answer.

    – Haroldo Gondim

    March 22, 2016 at 11:05 am

Add a comment | 

Question très active . Gagnez 10 points de réputation (sans compter le bonus d’association) afin de répondre à cette question. L’exigence de réputation aide à protéger cette question contre les spams et les activités sans réponse.

Pas la réponse que vous cherchez ? Parcourir les autres questions étiquetées

  • hôte local
  • wamp

ou posez votre propre question.

  • Le blog de desbordamiento
  • Ethereum finalmente se fusiona, los semiconductores siguen siendo escasos (Ep. 490)

  • Tendencias de desbordamiento de pila : actividad del sitio entre semana y fin de semana

  • Destacado en Meta
  • Cambios recientes de contraste de color y actualizaciones de accesibilidad

  • ¡Revisor por la borda ! O una solicitud para mejorar la guía de incorporación para nuevos…

  • Actualisation de colectivos : miembros reconocidos, artículos y GitLab

  • ¿Debo explain the solo code answers of other characters?

Report this ad



¿Por qué http://localhost/ no carga nada con WAMP?


localhost wamp server: page 8080 contains errors


Localhost nego a conectar Wamp



http://localhost/ does not work on Windows 7. What is the problem?


How to connect to my webserver http://localhost from android emulator


Cannot use WAMP, port 80 is used by IIS 7.5


Access localhost from a virtual machine


Access localhost after installing WAMP


Localhost inaccessible with WAMP

Preguntas calientes of the red

  • Cifrado ROT13 mediante indexing of matrix
  • ¿Cómo hacer que los Lilim se reproduzcan de verdad?
  • ¿Por qué “gráfico” means violent or sangriento?
  • Transform los ejes de un gráfico de contorno
  • Fetch ETH into a smart contract
  • Un compañero de trabajo siempre me pide que haga cosas pequeñas cuando no son mi responsabilidad
  • ¿Por qué las luces intermittents de los automóviles parpadean al double de velocidad cuando una luz intermittent se ha quemado?
  • Why will Windows 10 list “Windows_NT” as the operating system?
  • ¿Qué tan important es tener muchas marches en una bicicleta eléctrica?
  • In el LM, what is the difference between ABORT and ABORT STAGE?
  • ¿Cuál es el olor después de frotar el cuarzo?
  • ¿Es better fusionar mi SOP y PS en un solo ensayo o simplese unir los dos archivos uno tras otro para crear un solo archivo?
  • El destinatario afirma que el check de caja no se liquidará
  • ¿Contrarrestar el Lidar of free electrons?
  • ¿Necessary to replace a battery cargada del cortacésped que indica menos de 12 volts?
  • ¿Por qué el condensador de derivación no provoca un cambio de fase en este circuito oscillador?
  • ¿Los personajes tienen que esperar 24 horas para un descanso prolongado, if un descanso prolongado is interrupted?
  • ¿Podrá la princesa escapar usando artesanía de mala calidad en una cerradura de un solo lado?
  • ¿Se puede realizar una varied ad suave como la imagen de una función suave?
  • ¿Cómo resuelvo este sudoku sin divinar?
  • Easy and economical way to absorb more than 5 A from a power source
  • ¿D&D Beyond does not notice that the attack bonus of mi guardabosques is higher than its Dex mod + bonus of Archery Fighting Style?
  • Send a correo electrónico to a compañero de trabajo Durante el tiempo de duelo
  • ¿Existen sistemas aromáticos que no contengan anillos?

Feed of preguntas

Subscribe to an RSS

Feed of preguntas

To subscribe to an RSS feed, copy and follow this URL as an RSS reader.

Video Localhost refused to connect wamp

Related Posts

Free chat room code for my website

Contents1 How to set up a free chat room on the website.2 3 comentarios2.1 Trackbacks/Pingbacks2.2 Submit a Comment Cancel reply3 How to Create a Chat Room Website…

Background image full screen css

Contents1 Cómo – Full Page Image1.1 Example1.2 Example2 CSS background image tamaño tutorial: how to codify a complete page background image3 Perfect Full Page Background Image3.1 Méthode CSS géniale,…

WordPress leverage browser caching

Contents1 Aproveche el almacenamiento in hidden del navegador1.1 Will it works for my website?1.2 Where are plugin options1.3 Some JavaScript files still display under Leverage Browser Caching1.4…

WordPress post to facebook page

Contents1 How to Automatically Post to Facebook from WordPress1.1 Download Now: How to Launch a WordPress Website [Free Guide + Checklist]1.2 1. Create an IFTTT account.1.3 2….

Download images from wordpress media library

Contents1 How to export your WordPress media library1.1 Download maintenant : How to launch a WordPress website [Free Guide + Checklist]1.2 How to export your WordPress media…

WordPress single post template

Contents1 How to Create Custom Unique Post Templates in WordPress2 Post Template Files2.1 author.php2.2 Fecha.php3 Handbook navigation4 How to Create Custom Single Post Templates in WordPress5 Video…