{"id":9712,"date":"2021-09-01T17:58:36","date_gmt":"2021-09-01T17:58:36","guid":{"rendered":"https:\/\/linuxways.net\/?p=9712"},"modified":"2021-09-01T18:00:11","modified_gmt":"2021-09-01T18:00:11","slug":"what-is-localhost","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/what-is-localhost\/","title":{"rendered":"What is Localhost?"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p><strong>Localhost<\/strong> is a combination of two words &#8220;local&#8221; (your computer) and &#8220;host&#8221; (server) is a term for a server running on a personal computer.<\/p>\n<p><strong>Localhost<\/strong> allows you to access network services running on that computer using a loopback network port. It is like a web server including Apache, MySQL, PHP, and PHPmyadmin. Below we will tell you what localhost is as we go through it below.<\/p>\n<h2>127.0.0.1\/loopback address<\/h2>\n<p><strong>Localhost<\/strong> is not just a term but it can also be a domain name. It is a network address. If you type \u201cgoogle.com\u201d, it will navigate to Google home. So if you type localhost, it will navigate to your own device. In this case, it will use an IP address let the domain name localhost point to, this special address is called the loopback address.<\/p>\n<p>The default loopback address is <strong>127.0.0.1<\/strong>, located in the loopback IP range of your computer is from <strong>127.0.0.0 <\/strong>to <strong>127.255.255.255<\/strong>. If open address <strong>127.0.0.1<\/strong> with<strong> IPv4 <\/strong>connection, it will enable loopback. You can enable loopback with <strong>IPv6 <\/strong>connection by typing :1.<\/p>\n<h2>Purpose of Localhost<\/h2>\n<p>What can you do with <strong>localhost<\/strong>? There are 3 special advantages that loopback\/localhost does:<\/p>\n<p><strong>1. Check the internet connection:<\/strong><\/p>\n<p>You can check the internet connection by using the ping command. Open the terminal and type \u201cping 127.0.0.1\u201d or \u201cping localhost\u201d to check:<\/p>\n<pre>$ ping 127.0.0.1<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"413\" class=\"wp-image-9713\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-300x117.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-1024x400.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-768x300.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<p><strong>2. Check software or web applications<\/strong><\/p>\n<p>This is very useful for programmers when they create web applications or software that need an internet connection.<\/p>\n<p><strong>3. Block site<\/strong><\/p>\n<p>The essence of this is that you change the IP address of a domain name to <strong>127.0.0.1<\/strong>. For example, I want to block the domain \u201cgoogle.com\u201d:<\/p>\n<p>Firstly. we will access to hosts file by text editor:<\/p>\n<pre>$ sudo nano \/etc\/hosts<\/pre>\n<p>Secondly, you type:<\/p>\n<pre>127.0.0.1 google.com<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1059\" height=\"575\" class=\"wp-image-9714\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-1.png 1059w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-1-300x163.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-1-1024x556.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-1-768x417.png 768w\" sizes=\"auto, (max-width: 1059px) 100vw, 1059px\" \/><\/p>\n<p>Save it and the domain \u201cgoogle.com\u201d was being blocked.<\/p>\n<h2>Conclusion<\/h2>\n<p>You have just seen the details of what localhost is, what <strong>127.0.0.1\/loopback<\/strong> is, and their purpose.<\/p>\n<p>Thanks for reading.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction Localhost is a combination of two words &#8220;local&#8221; (your computer) and &#8220;host&#8221; (server) is a term for a server running on a personal computer. Localhost allows you&hellip;<\/p>","protected":false},"author":1,"featured_media":9785,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[515],"class_list":["post-9712","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-localhost"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9712","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=9712"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9712\/revisions"}],"predecessor-version":[{"id":9769,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9712\/revisions\/9769"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/9785"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=9712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=9712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=9712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}