2

I'm using dnsmasq for my local development environment but I want to use multiple TLDs, currently my dnsmasq.conf file looks like this

address=/.dev/127.0.0.1

& apache http-vhosts.conf looks like this

<Virtualhost *:80>
  UseCanonicalName Off
  VirtualDocumentRoot "/Users/<username>/Sites/dev/%1"
  ServerAlias *.gabri
  LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
  ErrorLog "/Users/<username>/Sites/dev/vhosts-error_log"
</VirtualHost>

and this configuration works, just create a new folder called 'client' for example then you can access it from client.dev.

Now I want to add another TLD let's say .test how can this be done? I guess in Apache it's the same but replacing dev with test, what about dnsmasq?

4

1 回答 1

2

在你的 dnsmasq.conf 添加:

address=/.test/127.0.0.1

在你的 http-vhosts.conf 添加:

<Virtualhost *:80>
  UseCanonicalName Off
  VirtualDocumentRoot "/Users/<username>/Sites/test/%1"
  ServerAlias *.test
</VirtualHost>

使用以下内容创建文件“/etc/resolvers/test”:

nameserver 127.0.0.1

有关解析器的更多信息。您还可以编辑“/etc/hosts”文件。我更喜欢 /etc/resolvers 解决方案。

之后不要忘记刷新 DNS 缓存。

于 2013-09-13T01:23:47.797 回答