Questions tagged [hostname]

A hostname is a human-readable nickname that is assigned to a device connected to a computer network and that is used to identify the device.

A hostname is a label that is assigned to a device connected to a computer network and that is used to identify the device in various forms of electronic communication such as the World Wide Web, e-mail or Usenet. Hostnames may be simple names consisting of a single word or phrase, or they may have appended a domain name, which is a name in a Domain Name System (DNS), separated from the host specific label by a period (dot). In the latter form, the hostname is also called a domain name. If the domain name is completely specified including a top-level domain of the Internet, then the hostname is said to be a fully qualified domain name (FQDN).

1162 questions
31
votes
12 answers

How to get a subdomain using window.location?

If I have a hostname such as: http://sample.example.com and in Javascript I do window.location.hostname, would I get "example.com" or "sample.example.com"? If not, how would I be able to get sample.example.com?
LB.
  • 13,730
  • 24
  • 67
  • 102
29
votes
5 answers

puppet node hostname

I'm using puppet to configure servers. I want to print current machine (node) name in *.erb template. There is hostname variable, but this holds puppetmaster hostname. Is there any good reference/list regarding to this topic?
Michal Bryxí
  • 1,166
  • 1
  • 11
  • 18
27
votes
2 answers

Is there an easy way to get the ServerName in Symfony?

I have been searching for an easy way to get the ServerName of the machine where Symfony runs in Symfony (so that my app adapts when it is used on a host with a different ServerName), but I couldn't find one. I created a variable in app.yml and I…
greg0ire
  • 22,714
  • 16
  • 72
  • 101
25
votes
1 answer

Get the hostname from a DataSource class

Is there a way to get the hostname from the DataSource type in java? I mean, I have a DataSource object (DS), which is annotated to get the JBoss datasource. Anyway, I want to get the hostname used in that DS. Debugging, i can see it this way: I get…
Ron
  • 2,215
  • 3
  • 22
  • 30
25
votes
4 answers

IP Address to Hostname in Java?

My hosts file (C:\WINDOWS\system32\drivers\etc\hosts) has a bunch of IP Address to host name mappings: # Switches 192.168.200.254 sw-con-ctrl 192.168.201.253 sw-con-ctrl-2 192.168.201.254 sw-con-ctrl-1 # 192.168.188.1 …
mainstringargs
  • 13,563
  • 35
  • 109
  • 174
24
votes
9 answers

In Java 8, how do I get my hostname without hard-coding it in my environment?

We just upgraded to Java 8 on Amazon Linux. We are using Spring 4.3.8.RELEASE. It used to be that we could get our machine hostname by setting up beans in our application context file like so ...
Dave
  • 15,639
  • 133
  • 442
  • 830
21
votes
7 answers

How do I configure the hostname for Rails ActionMailer?

I'm working on a fairly traditional forgot password email - I want to email the user a password change token embedded in a link that they can click on in order to change their password. I'm emailing via the traditional ActionMailer. If I use a…
edebill
  • 7,655
  • 5
  • 32
  • 31
20
votes
3 answers

rspec route testing and hosts

I see I can test routes with rspec like this: get("/").should route_to("welcome#index") but I have constraints based on the hostname or parts of hostnames and redirects between several ones. How do I specify a hostname when testing? How do I run…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
20
votes
9 answers

kubectl : Unable to connect to the server : dial tcp 192.168.214.136:6443: connect: no route to host

I recently installed kubernetes on VMware and also configured few pods , while configuring those pods , it automatically used IP of the VMware and configured. I was able to access the application during that time but then recently i rebooted VM and…
Vicky
  • 319
  • 3
  • 6
  • 16
20
votes
2 answers

Setting the Hostname in IIS Bindings Breaks Website

I just got a Windows Server 2008 VPS and I'm having trouble getting IIS7 setup. I created a new website in IIS with the path, ip address, and hostname (like 'www.nameofsite.com') and click OK. When I browse to the site it pulls up…
Josh
19
votes
3 answers

How to resolve hostname to an ip address in node js

I need to resolve hostname defined in hosts file to its corresponding IP address. For example my host file look like this - "/etc/hosts" 127.0.0.1 ggns2dss81 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.253.8…
Abhilash Kant
  • 358
  • 1
  • 2
  • 10
19
votes
3 answers

How can I add hostnames to a container on the same docker network?

Suppose I have a docker compose file with two containers. Both reference each other in their /etc/hosts file. Container A has a reference for container B and vice versa. And all of this happens automatically. Now I want to add one or more hostnames…
saada
  • 2,612
  • 3
  • 27
  • 33
18
votes
3 answers

Extract domain name from a host name

Is there a programatic way to find the domain name from a given hostname? given -> www.yahoo.co.jp return -> yahoo.co.jp The approach that works but is very slow is: split on "." and remove 1 group from the left, join and query an SOA record using…
Eliean I.
18
votes
2 answers

Ansible get hostname as defined in inventory

In my inventory I define hosts like this: [server1] 141.151.176.223 I am looking for a variable which keeps the server1 name, as I am using it to define server hostname. inventory_hostname is set to 141.151.176.223 ansible_hostname as well as…
Tom Raganowicz
  • 2,169
  • 5
  • 27
  • 41
18
votes
4 answers

zsh prompt and hostname

I use the following prompt in .zshrc: PROMPT="%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%1~ %{$reset_color%}%# " When I open terminal I see this prompt: zoltan@zoltan-Macbook-Pro ~ % Is it possible to drop the text "zoltan"…
Zoltan King
  • 1,964
  • 4
  • 18
  • 38
1 2
3
77 78