[{"data":1,"prerenderedAt":294},["ShallowReactive",2],{"Categories":3,"NavIndexCategoriesCountFooter":203,"content-\u002F2013\u002F02\u002F08\u002Fsetting-a-fixed-hostname-alias-on-mac-overriding-dhcp\u002F":204},[4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202],{"category":5},"System Administration",{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},"Software Development",{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":27},{"category":27},{"category":67},"Drones & RC",{"category":69},"DIY Projects",{"category":67},{"category":72},"Photography",{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":67},{"category":67},{"category":72},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":5},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":67},{"category":67},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":72},{"category":67},{"category":138},"3D Printing - Laser Cutting - CNC",{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":5},{"category":138},{"category":27},{"category":27},{"category":138},{"category":138},{"category":72},{"category":158},"Photography,3D Printing - Laser Cutting - CNC",{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":67},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":181},"Home Assistant",{"category":181},{"category":72},{"category":27},{"category":27},{"category":72},{"category":138},{"category":5},{"category":72},{"category":72},{"category":138},{"category":27},{"category":181},{"category":181},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},191,{"id":205,"title":206,"body":207,"category":278,"date":279,"description":213,"embedImage":278,"extension":280,"image":278,"intro":278,"meta":281,"navigation":282,"path":283,"seo":284,"series":278,"sitemap":285,"stem":286,"tags":287,"__hash__":293},"content\u002F2013\u002F02\u002F08\u002Fsetting-a-fixed-hostname-alias-on-mac-overriding-dhcp.md","Setting a fixed hostname alias on mac overriding DHCP",{"type":208,"value":209,"toc":275},"minimark",[210,214,217,220,223,226,229,232,262,265,268,271],[211,212,213],"p",{},"This turned up as an issue when developing webapps.",[211,215,216],{},"If you set a fixed hostname (local.foo.bar for example) via an \u002Fetc\u002Fhosts alias to 127.0.0.1 (perhaps you need to have access to .foo.bar cookies or similar) then you can browse localhost via the local.foo.bar name.",[211,218,219],{},"However - when starting tomcat under java this gave an error on hostname\u002Furl. I've had the issue running tomcat 6 under java 7 - have had reports of tomcat 7 under java 6 also being an issue.",[211,221,222],{},"It turns out that Mac OSX takes the hostname given by DHCP - and this can change often.",[211,224,225],{},"It seems to be trying to do some kind of network lookup\u002Fmatching and won't start tomcat unless it finds a good match.",[211,227,228],{},"So - you need to force the mac to ignore hostname allocation by setting a fixed hostname.",[211,230,231],{},"For Lion and Mountain Lion:",[233,234,239],"pre",{"className":235,"code":236,"language":237,"meta":238,"style":238},"language-shell shiki shiki-themes github-dark","scutil --set HostName local.foo.bar\n","shell","",[240,241,242],"code",{"__ignoreMap":238},[243,244,247,251,255,259],"span",{"class":245,"line":246},"line",1,[243,248,250],{"class":249},"svObZ","scutil",[243,252,254],{"class":253},"sDLfK"," --set",[243,256,258],{"class":257},"sU2Wk"," HostName",[243,260,261],{"class":257}," local.foo.bar\n",[211,263,264],{},"Previous versions of OSX had some settings in \u002Fetc\u002Fhostconfig - but I don't have an old enough install to test on.",[211,266,267],{},"YMMV on whether you need sudo or not for editing \u002Fetc\u002Fhosts and scutil call",[211,269,270],{},"Tip: Don't pick an alias that's an existing host - it'll prevent you reaching that host by name :)",[272,273,274],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":238,"searchDepth":276,"depth":276,"links":277},2,[],null,"2013-02-08 11:05:34 +0100","md",{},true,"\u002F2013\u002F02\u002F08\u002Fsetting-a-fixed-hostname-alias-on-mac-overriding-dhcp",{"title":206,"description":213},{"loc":283},"2013\u002F02\u002F08\u002Fsetting-a-fixed-hostname-alias-on-mac-overriding-dhcp",[288,289,290,291,292],"java","mac","tomcat","dhcp","hostname","hmpH71rWIRuwJnjCf1-76qk1CZtOtC74wenGZXci3ig",1775293013287]