How can I determine which localhost port is running?
I just find out that when I simply type ‘localhost’ in the url without anything more in the path, the browser displays a message from a local backend test project in Express that I’ve made days ago.
I’m trying to stop this process.
I was sure that to have started this server on port 3001 but when I try to kill it , it says that there is no process running on this port.
I tried to kill 8080 as well, but the message is still displayed.
Obviously, I refreshed the page, I tried on several different browser, even restarted my computer.
Можно на пальцах объяснить, про суть localhost и порты?
Объясните, пожалуйста, простым языком.
Что такое localhost в адресной строке?
Почему бывают разные порты?
Где находится этот localhost, в каких директориях?
- Вопрос задан более трёх лет назад
- 25584 просмотра
Оценить 2 комментария
- Вконтакте

Если человек, не знакомый с арифметикой захочет понять, что означает «два плюс три равно пять», ему недостаточно объяснить, что такое «два», или что такое «плюс»!
Так же и тут. Для понимания, что такое localhost, сначала нужно понять, что такое хост вообще, что такое сеть, что такое имя хоста, что такое сервер, как это все связано с адресами и номерами портов, а те — с, собственно, одним конкретным компом (который, в зависимости от контекста, могут называть и «хостом», и «сервером», и «localhost»). Так что, чтоб можно было объяснить на пальцах, уточните, с какого места, собственно, непонятно.


Если человек, не знакомый с арифметикой захочет понять, что означает «два плюс три равно пять», ему недостаточно объяснить, что такое «два», или что такое «плюс»! Так же и тут. Для понимания, что такое localhost, сначала нужно понять, что такое хост вообще, что такое сеть, что такое имя хоста, что такое сервер, как это все связано с адресами и номерами портов, а те — с, собственно, одним конкретным компом (который, в зависимости от контекста, могут называть и «хостом», и «сервером», и «localhost»). Так что, на всякий случай:
Комп, подключенный к сети, называют хостом. К нему обращаются по уникальному адресу или имени. Одному имени (т.е. одному хосту) могут соответствовать несколько разных адресов.
Когда к хосту обращаются по имени, это имя сначала разрешается в адрес хоста, по которому, собственно, и происходит обращение. В сети этим обычно занимается DNS (который, кстати говоря, тоже является сервером. но это уже другая история, которая сейчас не так важна для понимания сути), но если DNS нет, соответствие имен-адресов можно прописать в файле hosts на самом хосте. Если некое имя хоста и там не прописано, обратиться к нему по имени не удастся. хотя прямое обращение по адресу будет работать.
Сервер — это программа, отвечающая на запросы из сети. Комп, на котором она выполняется, также называют «сервером». Причем, даже если выполнение программы приостановлено (например, проводят профилактику или программа-сервер упала), этот комп все равно будут называть «сервером», ибо он предназначен, в основном, для выполнения этой программы.
На одном компе (=хосте, сервере) может одновременно выполняться несколько разных программ-серверов. Для того, чтоб обратиться к конкретной из них (адрес-то у всех один и тот же!), в протоколе TCP/IP используются разные номера портов.
Если на компе запущен, например, HTTP сервер (= Webserver, например, Nginx или Apache), он «слушает» порт 80, а если не запущен, порт 80 никто не слушает, и если обратиться к такому хосту (= серверу, компу) по его адресу в порт 80, никакого ответа не придет. хотя сам хост и будет доступен.
Для разных общеизвестных типов программ-серверов (в этом случае также говорят о «сервисах» или же «протоколах», что в данном контексте практически одно и то же) принято использовать общеизвестные номера портов, а для наиболее распространенных (как тот же HTTP) можно даже не указывать номер порта при обращении, как мы обычно и делаем в строке броузера, т.к. клиент автоматически использует номер порта по умолчанию, в данном случае 80. Но, в принципе, любой сервис можно (переконфигурировав) использовать на любом порту. если, конечно, в этом есть смысл. Единственно, что нельзя — одновременно использовать разные серверы на одном порту.
И, наконец, было бы совсем глупо, если бы для обращения к какому-то серверу на одном хосте в сети обязательно был бы нужен еще и другой комп, с которого обращаться. Вот и придумали возможность обратиться к программе-серверу с того же хоста, на котором она выполняется, т.е. локально, а чтоб не гадать, по какому адресу или имени это делать, ввели понятие localhost.
localhost — «общеизвестное» имя компа для самого себя и ему соответствует IP адрес 127.0.0.1. Это — общепринятая договоренность, которую просто нужно знать. Если говорят «установить сервер на localhost», это означает «установить на тот самый комп, с которого и обращаться к этому серверу».
How to check which localhost's ports are used on the terminal? [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago .
I’m working on the Linux Ubuntu terminal and I’m wondering how to check directly on terminal which localhost ports are used please ?
![]()
2 Answers 2
You can use use the ss command.
The n option means don’t translate addresses to names. The a options means show all (listening and non-listening) connections. The t option means TCP connections. The ‘u’ option means show UDP connections.
Note that ss might not be in your path by default. For example, you might need to run /sbin/ss .
Quick Answer: How Do I Find My Localhost Port?
Go to ngrok.com, download the archive and extract it to wherever you’d like ngrok to live on your computer.
In the example above, we’ve got traffic to a randomly generated ngrok address of http://3dfab6bf.ngrok.com being forwarded to our localhost on 127.0.
How do I know if a port is listening
In order to check which application is listening on a port, you can use the following command from the command line:For Microsoft Windows: netstat -ano | find “1234” | find “LISTEN” tasklist /fi “PID eq “1234”For Linux: netstat -anpe | grep “1234” | grep “LISTEN”Dec 22, 2020
How do I find my localhost
4 Answers. To access the server from itself, use http://localhost/ or http://127.0.0.1/ . To access the server from a separate computer on the same network, use http://192.168.X.X where X.X is your server’s local IP address. You can find the sever’s local IP address (assuming it’s Linux) by running hostname -I .
How do I check my ports
How to find your port number on WindowsType “Cmd” in the search box.Open Command Prompt.Enter the “netstat -a” command to see your port numbers.Jun 19, 2019
How do I find my service port
Open a command prompt window (as Administrator) From “Start\Search box” Enter “cmd” then right-click on “cmd.exe” and select “Run as Administrator”Enter the following text then hit Enter. netstat -abno. … Find the Port that you are listening on under “Local Address”Look at the process name directly under that.May 18, 2014
Can I access localhost but not IP
If you can access a server running on your own machine via 127.0. 0.1 (or localhost ) but not via the computer’s ip address, this means that the server software is configured to listen on the localhost interface only.
How do I check ports in Windows
* To display all open ports, open command prompt (Start -> Run -> Cmd), type netstat and press Enter. * To list all listening ports, use netstat -an |find /i “listening” command. * To find specified open port, use find switch. For example, to find if the port 1433 is open or not, do netstat -an |find /i “1433“.
What ports can I use for localhost
Following is some of the recommended localhost ports for local developments.Recommended Express.js (or LoopBack ) Dev Port: 3000, 8000, 8080 (by npm start )Default Angular Webpack Dev Port: 4200 (by ng serve )Default Ionic Webpack Dev Port: 8100, 8200 (by ionic serve or ionic lab )
What is netstat command
The netstat command generates displays that show network status and protocol statistics. You can display the status of TCP and UDP endpoints in table format, routing table information, and interface information. The most frequently used options for determining network status are: s , r , and i .
What is a 192.168 IP address
The IP address 192.168. 0.1 is one of 17.9 million private addresses, and it’s used as the default router IP address for certain routers, including some models from Cisco, D-Link, LevelOne, Linksys, and many others.
Can you see me port check
Canyouseeme is a simple and free online tool for checking open ports on your local/remote machine. … Just enter the port number and check (the result will be either open or closed). (Your IP Address is already selected by default, but it may not detect your IP correctly if you’re using a proxy or VPN).
How do I check my netstat
How to search netstat details on Windows 10Open Start.Search for Command Prompt, right-click the top result, and select the Run as administrator option.Type the following command to list all the connections that have the state set to LISTENING and press Enter: netstat -q | findstr STRING.Oct 15, 2020
How do I find my local host IP address
Open up the Command Prompt via your Windows Start menu. Type in “ipconfig” and hit Enter. Look for the line that reads “IPv4 Address.” The number across from that text is your local IP address.
Is port 80 and 8080 the same
No Port 80 and Port 8080 are not the same. Ports are used to make connections unique and range from 0 to 65535 out of which upto 1024 are called well known ports which are reserved by convention to identify specific service types on a host. … Port 8080 is the just the default second choice for a webserver.
How do I run a localhost on a different port
Set up port forwardingSet up remote debugging between your development machine and your Android device. … Click Port forwarding button. … Check Enable port forwarding. … In the Port textfield on the left, enter the localhost port number from which you want to be able to access the site on your Android device.More items…•Apr 13, 2015
How do I change my localhost port
Open C:\xampp\apache\conf, find the httpd. conf file and open with notepad++. Look for these lines and change 80 in the last line any other port, for example 8080. This way we will be able to run Apache but the http://localhost/url won’t work for that you need to append port number into the URL.
What is the difference between localhost and IP address
So, to answer your question – yes, they are different. localhost is given an ip address in the 127.0. 0.0 network and given to a virtual loopback network device lo . … The name localhost is simply a name that resolves to this IP address and is configured in /etc/hosts .
How do I find my IP address and port number
How do I find the port number of a specific IP address? All you have to do is type “netstat -a” on Command Prompt and hit the Enter button. This will populate a list of your active TCP connections. The port numbers will be shown after the IP address and the two are separated by a colon.