localhost
Если вы хотите перейти на http://localhost, то воспользуйтесь быстрыми ссылками для входа:
- http://localhost
- http://localhost:8080
- http://localhost:8081
- http://localhost/phpmyadmin
- http://localhost/WordPress
- http://localhost:3000
- http://localhost/php
- http://localhost/index
- http://localhost/index.php
- http://localhost/server
- http://localhost/bonfire
Что такое localhost
localhost — это универсальное имя хоста, которое всегда указывает на этот же самый компьютер. Точнее говоря, это имя указывает на IP адрес 127.0.0.1, а данный IP уже является специальным адресом, всегда принадлежащий локальному компьютеру.
Если открыть адрес http://localhost в веб-браузере, то будет выполнено подключение к локальному веб-серверу. По этой причине localhost обычно ассоциируется с веб-сервером, но на самом деле localhost можно использоваться самыми разными сетевыми службами: программами для обмены данными между собой, MySQL, SSH, FTP и пр.
Вы можете даже пинговать localhost:
Пинги будут самыми лучшими из всех, какие вы когда-либо видели, поскольку проверяется соединение до этого же самого компьютера, на котором выполняется пинг.
Про loopback будет чуть ниже — на случай, если вам интересна теория, а сейчас рассмотрим, почему не работает localhost.
Как включить localhost
Возможно вы и так знали, что localhost это локальный веб-сервер, но при попытке открыть
http://localhost у вас возникает ошибка, например такая:
Не удается получить доступ к сайту
Сайт localhost не позволяет установить соединение.
Попробуйте сделать следующее:
Проверьте подключение к Интернету.
Проверьте настройки прокси-сервера и брандмауэра.
ERR_CONNECTION_REFUSED
Причин может быть несколько, самая популярная — вы просто не установили веб-сервер. Если это действительно так, то переходите к инструкции «Как установить веб-сервер Apache c PHP, MySQL и phpMyAdmin на Windows».
После завершения указанной инструкции localhost заработает!
Веб-сервер установлен, но localhost не открывается
В этом случае причины могут быть следующие:
- веб-сервер установлен, но его служба не запущена (особенно если раньше работало, а после перезагрузки перестало работать) — вернитесь к инструкции по установке, запустите службу веб-сервера и добавьте её в автозагрузку;
- неправильно настроены права доступа в веб-сервере, либо ошибка в конфигурации — вернитесь к настройке веб-сервера или переустановите его.
127.0.0.1
127.0.0.1 — это специальный IP адрес, который имеет loopback интерфейс. В любой операционной системе имеется поддержка 127.0.0.1, поскольку этот специальный IP описан в протоколе.
Суть работы 127.0.0.1 (а следовательно и localhost, который является именем для указания на этот IP) состоит в том, что пакет, отправленный на адрес 127.0.0.1 на самом деле никуда не отправляется, но при этом система начинает считать, что этот пакет пришёл из сети. То есть образно можно представить так: пакет отправляется на сетевую карту компьютера, там разворачивается и возвращается с сетевой карты обратно в компьютер.
Несмотря на кажущуюся бесполезность, такой подход очень популярен и используется для взаимодействия с самыми разными программами.
http://localhost:8080
Чтобы подключиться к localhost на 8080 порту перейдите по ссылке http://localhost:8080
localhost php
Чтобы использовать PHP на своём компьютере нужно установить веб-сервер. Пошаговую инструкцию смотрите в статье «Как установить веб-сервер Apache c PHP, MySQL и phpMyAdmin на Windows».
localhost phpmyadmin
Аналогично, для получения phpMyAdmin установите веб-сервер.
localhost error
Ошибки могут возникнуть в случае неправильной установки веб-сервера или приложений. Смотрите «Ошибки при настройке и установке Apache, PHP, MySQL/MariaDB, phpMyAdmin».
Localhost Refused to Connect Error: 5 Confirmed Ways to Fix It
Among the different network connection errors you might encounter is localhost refused to connect or the ERR_Connection_Refused error.
When you try to connect to an IP address, you usually try to connect to a different computer. However, since localhost uses the loopback address network, connecting to it means you’re establishing a connection with your own computer.
That’s why many users, like developers and network administrators, use localhost to test programs or sites that are still in development, as it reduces the risk of breaking a live site.
Thus, when you can’t access localhost, you won’t be able to access your project in a local environment.
There are various causes of this error, as shown in the table below:

What Is the Localhost Refused to Connect Error?
It is a common error that can happens when working on local machines. The localhost simulates a web server running on your computer. When the “localhost refused to connect” error appears, it is likely due to misconfigured port. Other common reasons include insufficient permissions and the Apache webserver not running properly.
How to Fix Localhost Refused to Connect – Video Tutorial
Learn how to fix the localhost refused to connect error with four simple methods in our video tutorial.

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
- Navigate to System Preferences.
- Select Security and Privacy.

- Select the Firewall tab to see the complete firewall settings.
- Click the lock icon, then enter your username and password.
- 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.
- 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:
- Open the control panel, then navigate to System and Security -> Windows Defender Firewall.

- Select Turn Windows Defender Firewall on or off.

- Switch off both firewalls in the private and public network settings.
- 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 for turning off the firewall via the command prompt:
- Open the command prompt as administrator.
- Enter the following command:
How to Disable the Firewall in Linux
The steps to stop and disable the firewall vary according to your Linux distribution.
If you use Ubuntu or Debian, your firewall should be managed by ufw. If you use CentOS or RHEL, the default firewall management tool will be firewalld.
It’s important to stop the firewall first before disabling it. Otherwise, you’ll experience errors during the process.
To disable the firewall on ufw, follow these steps:
- Stop the ufw using this command:
- Once the firewall successfully stops, run a command to disable the ufw service at boot time.
- Verify that the ufw is disabled by using this command:
- Re-enable the ufw.
Alternatively, here are the steps to stop and disable the firewall on firewalld:
- Stop the firewalld using the following command.
- Disable the firewalld at boot time by using this command.
- Simply enter this command to verify if the firewalld has been disabled.
- Run the following commands to enable firewalld again.
2. Flush Your DNS
The DNS cache stores data from websites you visit, so these web pages will load quicker the next time you access them.
However, if the DNS contains too many records, it might fail to function.
To solve this, flush the DNS to erase the records:
- Open the command prompt by typing cmd on the search bar next to the start menu.
- Enter this command:
- Check whether the 127.0 0.1 refused to connect issue has disappeared 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.
- Click the Start Menu to start XAMPP.
- Click the Netstat button on the right side of the control panel.
- You’ll see all the used ports on your computer. Check whether port 80 is free or used by another application.

- 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:
- Click the Start Menu to start XAMPP.
- You’ll see the XAMPP icon in your taskbar’s system tray. Double click it.
- The XAMPP control panel window will appear. It will show a list of all currently running services.
- Click on the Stop button next to Apache.

- Open the file explorer, then find the httpd.conf file in the config folder. If you use Windows, it will be in the C:\xampp\apache\conf directory. If you use Linux, it will be in bin/apache. On Mac, the path will be Applications/XAMPP/xamppfiles/etc/httpd.conf.
- Open it using Notepad or any other text editor available. Then, look for these lines inside the file:
- If your port 80 is free, just make sure that the port number in the Listen command matches the port number for 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.
- Save the file. It will ask for administrative privileges, choose Yes.
- Open the XAMPP control panel again, then start the Apache web server.
- Access http://localhost:8080 or https://127.0.0.1:8080/ 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.
- Right-click the taskbar and select Task Manager.
- Click End Task for any instances of WAMP that are still running.
- Next, open file explorer and navigate to the config folder in C:\wamp\apache2\conf.
- Look for the HTTPD config file. Open it with a text editor like Notepad.
- Look for these lines inside the file:
- If your port 80 is free, just make sure that the port number in the listen command matches the port number for the localhost. If port 80 is already used by another application, replace the number with an available port.
- Save the file.
- Open WAMP again to see if you still get the same error.
4. Ensure Apache Is Running
If your Apache web server is not running, you won’t be able to access localhost.
To check the status of your Apache, the command will vary depending on the distribution that you use.
Here’s the command for Debian or Ubuntu:
And here’s the command for CentOS/RHEL/Fedora:
The result from this status check will tell whether your server is running or stopped.
If it tells you that the server is stopped, try to troubleshoot by restarting it using the following command.
For Debian and Ubuntu:
The output of the restart command will look like this:
If the restart attempt fails, you’ll get an error message. The message may vary depending on your choice of distribution, but it will fall along these lines:
If you see these error messages, try to reinstall the service. Once you’re sure the web server is installed correctly, 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:
- Enter chrome://net-internals/#hsts on your browser’s address bar.

- Locate Delete domain security policies, then type localhost.
- Restart the browser.
Troubleshooting Other Errors
Conclusion
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.
Maya is a website development and digital marketing enthusiast, and 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.
http://localhost/ not working on Windows 7. What's the problem?
I have a big problem opening http://localhost/ on Windows 7 (beta). I installed this os and everything went great; when I installed Wamp I saw that localhost is not working at all. I just see this error:
Failed to Connect
Firefox can’t establish a connection to the server at localhost.
in Mozilla and Explorer.
I removed Wamp and after some weeks (that means two weeks from today) I installed NetBeans on Windows 7. I created a test PHP script and when I debug it, I get the same error again. I tried to access it with ip 127. but still the same. What is the problem?
When i installed NetBeans I installed it in port 8080.
22 Answers 22
If you installed it on port 8080, you need to access it on port 8080:
To fix the port 80 problem do:
From cmd as administrator:
- sc config http start= demand (you need a space after the equal sign and not before)
- Reboot
- Run the command ( netsh http show servicestate ) as administrator to check that the port 80 is in use
After you have run this command, you can disable http.sys as follows:
- net stop http (stop the process)
- Sc config http start= disabled (if you want to disable the service forever)
it works for me.
![]()
Edit your C:\Windows\System32\drivers\etc\hosts file
Make sure there is an entry that looks like this:
If there is an entry like
Comment it out to look like this
This should fix your problem, I’ve had this problem in the past.
![]()
For me, it was skype causing the problem. Once I stopped skype, everything worked. I have 1.7.1 xampp (mysql and apache) running on Windows 7 x64.
It sounds like you have no web server running at all anywhere.
Have you tried enabling IIS and using it to display a basic html file first?
Programs & Features -> Turn Windows Features On/Off -> Internet Information Servcies
Then, place your html file in C:\inetpub\wwwroot\index.html and browse to http://localhost.
Once this works, try to get WAMP/php working. Be careful of port conflicts.
My initial thought is that you are missing an entry in the hosts file. Something like «127.0.0.1 localhost», however, you mention that you are getting a 404 error. That means that the webserver is connecting to your client/browser and responding to the request for a particular webpage.
I’m not familiar enough with Windows 7, however, I’m pretty sure that it does not include a webserver by default. Also, unless you actually code, build and run a webserver application using netbeans you’re not going to get the desired response.
When it comes down to it. your issue is going to be one of the following:
1) you’re serving static documents and the webserver is not configured to serve the files from whatever the proper DOCROOT should be. This includes PUBLIC folders in the user’s directories. (the basic apache install include a basic homepage)
2) you have a dynamic webserver application where the controller is looking at the application path in order to decide what page to display or what function to execute. (see MVC — Controller). Basically incomplete implementation.
3) yet another configuration error: your website might actually define a virtual domain. (something other than localhost) so when you look for localhost in the URL the server might not be configured to provide a default page.
Форум русскоязычного сообщества Ubuntu

Увидели сообщение с непонятной ссылкой, спам, непристойность или оскорбление?
Воспользуйтесь ссылкой «Сообщить модератору» рядом с сообщением!
- Форум русскоязычного сообщества Ubuntu »
- Архив »
- Архив »
- Архив тем до 2016г »
- [РЕШЕНО] Не заходит в localhost
Автор Тема: [РЕШЕНО] Не заходит в localhost (Прочитано 112521 раз)
0 Пользователей и 1 Гость просматривают эту тему.
- Форум русскоязычного сообщества Ubuntu »
- Архив »
- Архив »
- Архив тем до 2016г »
- [РЕШЕНО] Не заходит в localhost
Страница сгенерирована за 0.15 секунд. Запросов: 23.
© 2012 Ubuntu-ru — Русскоязычное сообщество Ubuntu Linux.
© 2012 Canonical Ltd. Ubuntu и Canonical являются зарегистрированными торговыми знаками Canonical Ltd.