TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: What TLD do you use for local development?

45 点作者 Sevrene超过 8 年前
I&#x27;ve heard all sorts of reasons against using .local, .dev or .app. Is there a definitive standard for this?<p>What TLD do you use for local development? or do you just forgo the domain all together and use your local IP?

25 条评论

guessmyname超过 8 年前
I use &quot;.test&quot; to respect RFC-6761 [1] which reserves four TLDs: .example, .invalid, .localhost, and .test; as many of us already know &quot;.dev&quot; is owned by Google [2] and both &quot;.local&quot; [3] and &quot;.app&quot; [4] are reserved for the root zone so it doesn&#x27;t makes any sense to use any of them for local development. So I use &quot;.test&quot; for my personal projects and &quot;.[company]&quot; for projects related with my job.<p>[1] <a href="https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc6761" rel="nofollow">https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc6761</a><p>[2] <a href="https:&#x2F;&#x2F;icannwiki.com&#x2F;.dev" rel="nofollow">https:&#x2F;&#x2F;icannwiki.com&#x2F;.dev</a><p>[3] <a href="https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc6762" rel="nofollow">https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc6762</a><p>[4] <a href="https:&#x2F;&#x2F;icannwiki.com&#x2F;.app" rel="nofollow">https:&#x2F;&#x2F;icannwiki.com&#x2F;.app</a>
评论 #12579190 未加载
评论 #12579644 未加载
评论 #12579220 未加载
评论 #12579433 未加载
ryanlm超过 8 年前
I use a subdomain of a domain I own, such as internal.example.com<p>I can then run a BIND instance with internal.example.com as a root, then map all my services to their own domain if need be.<p>This is a little overkill for a one man shop, but it&#x27;s a nice little home development setup.<p>The one thing you need to configure, if you want it to work out of the box is that your DHCP server needs to send back the IP address of your local BIND service for DNS, else it won&#x27;t work right and you&#x27;ll need to manually configure it every time.<p>An example of where this worked well for me was when I was using one nginx instance to run snapshots of all my clients websites. With nginx, you can set up &quot;virtual hosts&quot; which map a hostname to a configuration block. You could also just edit your &#x2F;etc&#x2F;hosts file to accomplish the same thing I guess.
评论 #12579261 未加载
tdy721超过 8 年前
I use .dev of course! I realize that .test is the sensible choice, but there&#x27;s some odd WordPress&#x2F;Serialization benefit to keeping the TLD length the same.<p>Google bought it up, and I&#x27;ve never seen it in the wild, so it works well for me.
评论 #12579546 未加载
评论 #12583496 未加载
评论 #12579547 未加载
giancarlostoro超过 8 年前
I edit my host file and use .dev for specific domains, if you configure a web server to said domains it&#x27;ll route you to the right folder as well (edit: Virtual Host). Though I typically use Vagrant or VirtualBox to test my environments off a &#x27;remote&#x27; server.
SimeVidas超过 8 年前
Are there any issues with just using something like `localhost:3000`?
评论 #12579354 未加载
评论 #12579408 未加载
评论 #12579484 未加载
评论 #12580218 未加载
bigiain超过 8 年前
I remember a tile back in early the 2000s when we had a quite nice setup of local dns servers that had internal only zonefiles that resolved names like service.company.local to the internal&#x2F;dev versions of service.company.com.<p>Worked quite nicely until the Mac users upgraded to a version of OS X which included Bonjour...<p>There days Mac OS X does a pretty nice job here all on it&#x27;s own - this machine I&#x27;m typing on here happily answers as Iain.local to the internal network... (For some not-worth-my-time-to-debug reason, our Netgear NAS is a whole lot less reliable with it&#x27;s Bonjour&#x2F;zeroconf .local name...)
评论 #12579002 未加载
dmlittle超过 8 年前
You can modify your &#x2F;etc&#x2F;hosts to point to localhost and that does the trick without having to go through a TLD or care if the domain is taken.<p>Contents of &#x2F;etc&#x2F;hosts:<p>127.0.0.1 domain.com<p>127.0.0.1 subdomain1.domain.com<p>127.0.0.1 subdomain2.domain.com
评论 #12579714 未加载
评论 #12579429 未加载
laurencei超过 8 年前
I personally use &quot;.vm&quot;<p>I run a vagrant box on my Windows machine - so &quot;.vm&quot; describes what I do very well.<p>And unless a new country is formed, there will never be new 2 letter TLDs.
评论 #12579695 未加载
nstart超过 8 年前
I use a subdomain and run it in the form of dev.&lt;myactualdomain&gt;.com . I add a record to my &#x2F;etc&#x2F;hosts file to redirect it to 127.0.0.1. This also means for https stuff I have a valid certificate to use as well. One more note. I almost never run anything on any port other than port 80&#x2F;443. Any application I work on generally has nginx sitting in front of it with a simple proxy_pass rule.
voycey超过 8 年前
I still use .dev for the majority of sites, I&#x27;m pretty pissed that Google was allowed to appropriate it! It has so far bitten me on the ass once when a CDN was involved (the CDN resolved it to Googles servers so the failure wasn&#x27;t detected - causing numerous invisible problems).<p>I think I will probably go along the route of assigning a domain to my local network
thrillgore超过 8 年前
I have historically used .local despite its use with the Multicast DNS Standard. I have not encountered any technical issues with its use.<p>If my devices were on a network accessible from the outside world, I would have used my ghostfreeman.net domain and submasked all of those projects. However, these resources can&#x27;t leave the network.
fiddlerwoaroof超过 8 年前
I just use a subdomain of a domain I own
评论 #12578921 未加载
claydiffrient超过 8 年前
I use .docker because I use dinghy for all my development (<a href="https:&#x2F;&#x2F;github.com&#x2F;codekitchen&#x2F;dinghy#dns" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;codekitchen&#x2F;dinghy#dns</a>)
throwaway2016a超过 8 年前
Since no one has mentioned this one yet, I use &#x27;.loc&#x27; throught &#x2F;etc&#x2F;hosts<p>Each dev on the team use the same .loc domains but the IP may be different depending on the IP the Docker interface is assigned.
healthnutter超过 8 年前
One trick is to use non-routable (e.g. 192.168.0.0&#x2F;16) IP addresses with DNS records for subdomains of your company&#x27;s domain name, e.g. devserver123.mycompany.com routes to 192.168.100.123
评论 #12579805 未加载
na85超过 8 年前
I use .lan
kalleboo超过 8 年前
local.&lt;domain of site i&#x27;m working on&gt; set in my hosts file<p>Or just &quot;localhost&quot; if it&#x27;s a personal project with no domain
chrisabrams超过 8 年前
.bingo has been great.
smt88超过 8 年前
It doesn&#x27;t matter. Use anything fake&#x2F;non-public.
评论 #12579277 未加载
评论 #12579338 未加载
beilabs超过 8 年前
I use whatever domain I like + .lvh.me -&gt; 127.0.0.1
bdcravens超过 8 年前
lvh.me for non-public addresses where I want to test subdomains<p>ngrok.io when it needs to be public<p>(yeah, I know those aren&#x27;t TLDs, but I rarely use any when developing TBH)
评论 #12580157 未加载
avitzurel超过 8 年前
local.&lt;mydomain&gt; set it in my hosts file.
reustle超过 8 年前
I use dev.projectname.com
jay_kyburz超过 8 年前
192.168.1.2 FTW!
评论 #12579529 未加载
crisopolis超过 8 年前
lvh.me