Questions tagged [hosts]

A `hosts` file is used to map hostnames to IP addresses on a TCP/IP-enabled computer.

A hosts file is used to map hostnames to IP addresses on a TCP/IP-enabled computer. On Unix and Unix-like operating systems (Linux, OSX, FreeBSD, NetBSD, et al), the file is located at /etc/hosts. In Microsoft Windows, the file may be located in different places depending on the version of the operating system. In Plan 9 from Bell Labs it is located at /lib/ndb/hosts

On most systems, the behaviour of /etc/hosts depends on configuration within the /etc/nsswitch.conf file.

841 questions
7
votes
1 answer

Safari ignores /etc/hosts on macOS High Sierra

I tried to use /etc/hosts file to redirect some websites to localhost. To do so, I opened it in terminal using sudo nano /etc/hosts then I modified the file, and saved it. As the last step I flushed the DNS cache with sudo killall -HUP…
dnnagy
  • 3,711
  • 4
  • 24
  • 34
7
votes
2 answers

Vagrant not working with localhost extension on Chrome

I have a 2015 mac with macOs Sierra. After too many problems with apache and php, I've decided to run Vagrant. I'm running box.scotch.io for my work Before Vagrant I configured the hosts file as follows: 127.0.0.1 devsite.localhost 127.0.0.1…
John
  • 1,081
  • 1
  • 9
  • 34
7
votes
1 answer

Docker container unable to resolve localhost

I have a docker image which I have built from scratch, rather than basing it on an existing image such as centos or ubuntu. Processes on the machine do not seem to be able to resolve localhost or the machine hostname, even though the mapping for…
limp_chimp
  • 13,475
  • 17
  • 66
  • 105
7
votes
1 answer

What the difference between vagrant-hostsupdater and vagrant-hostmanager?

What the difference between this 2 vagrant plugins? I'm using vagrant-hostmanager which can update /etc/hosts file on host machine, as well as on guest machine, supports multi-machine vagrant setup. But when I tried to use this tool…
7
votes
1 answer

adding routes to the win/OSX hosts files without admin privileges, or using a complimentary hosts file

I've read How to configure user specific hosts file on Windows, it has no answers and is from 2012 so the chance that anyone revives it is pretty much zero. Here's my use case: we have a nodejs tool suite that lets users generate content that is…
Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
7
votes
2 answers

Run my php files from outside htdocs

I have my xampp installed and running sites from the htdocs folder. I want to create a website directory in a different location and run the files online from there. I know I can do this somehow using both Virtual Host settings and changing my…
Pierce McGeough
  • 3,016
  • 8
  • 43
  • 65
7
votes
1 answer

** server can't find hostname.com nxdomain

I am trying to set up an apache web server on my vm and im running into some issues. When I do an 'nslookup' on the hostname of the machine this is what I get: nslookup rhel64.xxxxx.xxxxx.com Server: xxx.xxx.32.1 Address: …
PT_C
  • 1,178
  • 5
  • 24
  • 57
7
votes
1 answer

Redirect Addresses to localhost by Pattern on Mac OS X

I'm not even 100% sure how to ask this question. The answer might be out there, but I can't find it. So I've set up virtual hosts for my Mac and I do all my development locally on my computer. I have a vhost folder in my Sites folder, and I have a…
CWSpear
  • 3,230
  • 1
  • 28
  • 34
6
votes
0 answers

What is hosts.ics file?

Sometimes I use the hosts file (C:\Windows\System32\drivers\etc\hosts), but unexpectedly now I have 2 files hosts and hosts.ics. hosts seems to be empty and hosts.ics looks like: # Copyright (c) 1993-2001 Microsoft Corp. # # This file has been…
bozydarlelutko
  • 511
  • 7
  • 21
6
votes
2 answers

Port to Service Name in Java?

My services file (C:\WINDOWS\system32\drivers\etc\services) has a bunch of Port to Service mappings: echo 7/tcp echo 7/udp discard 9/tcp sink null discard 9/udp sink null systat …
mainstringargs
  • 13,563
  • 35
  • 109
  • 174
6
votes
3 answers

Debugging why I get "You don't have permission to access" in Apache 2.4

I am trying to create a local environment in Linux/Ubuntu. I have install Apache 2.4.7 (using apt-get). I have changed my /etc/hosts to this: 127.0.0.1 example.dev 127.0.0.1 localhost ... I also added a file "example.dev.conf" to…
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
6
votes
1 answer

How do I hit a modified /etc/hosts from VirtualBox

I have an app that I have to change the /etc/hosts file to be able to hit. Here is my new file. #127.0.0.1 localhost 127.0.0.1 local.connectwithme This works easily on my local machine. I just go to local.connectwithme:3000 in my…
jhamm
  • 24,124
  • 39
  • 105
  • 179
6
votes
2 answers

blocking website via hosts file not working?

I'm trying to block a website using the hosts file using this tutorial : http://hackspc.com/how-to-block-a-website/ but It doesn't work, the website I'v blocked In this case facebook still shows up, please can anyone help me out here?
Parastar
  • 727
  • 2
  • 7
  • 5
6
votes
2 answers

Apache 2 Sites-Available Configuration

I am trying to write about 5 websites all on one Apache server which is all on one IP address. For example: /var/www/site1 /var/www/site2 /var/www/site3 /var/www/site4 /var/www/site5 However, if I create a link on site 2 just using, for example.…
Schodemeiss
  • 1,144
  • 3
  • 16
  • 37
6
votes
2 answers

Speed up Apache redirects by putting hostnames in hosts file

i am using apache and have a domain e.g.: www.example.com. I redirected example.com to www.example.com by using this: https://stackoverflow.com/a/1100363/441907 I also have a virtual host entry for www.example.com. I had then performance issues…
Nick Russler
  • 4,608
  • 6
  • 51
  • 88