Trouble serving vhosts when trying to set up wildcard subdomains with dnsmasq in local development e
Posted
by Jeremy Kendall
on Server Fault
See other posts from Server Fault
or by Jeremy Kendall
Published on 2010-05-15T13:59:53Z
Indexed on
2010/05/15
14:06 UTC
Read the original article
Hit count: 539
I'm trying to get wildcard DNS enabled on my laptop using dnsmasq. I realize that this has been asked and answered more than once on this forum, but I can't get the solution to work for me.
Steps taken so far:
- Installed dnsmasq
- Set
address=/example.dev/127.0.0.1
in dnsmasq.conf - Set
listen-address=127.0.0.1
in dnsmasq.conf - Ensured
nameserver 127.0.0.1
is in /etc/resolv.conf - Set
prepend domain-name-servers 127.0.0.1;
in /etc/dhcp3/dhclient.conf - Created a vhost for example.dev
- Restarted apache and dnsmasq
Note: example.dev is not set in /etc/hosts
My vhost for example.dev
<VirtualHost *:80>
ServerName example.dev
DocumentRoot /home/jkendall/public_html/example/public
ServerAlias *.example.dev
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory /home/jkendall/public_html/example/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The setup above will server example.dev locally without any problem. It will also serve test.example.dev, but test.example.dev returns the default apache "It works!" index.html from /var/www rather than my index.php in /home/jkendall/public_html/example/public.
The solution in this Server Fault thread suggests that
address=/.example.dev/127.0.0.1
would resolve my problem, but when I try to use that solution, restarting dnsmasq results in a failure with the error message
dnsmasq: error at line 62 of /etc/dnsmasq.conf
For grins, I moved my project over to /var/www/example and modified the vhost appropriately. I got the same result as described above.
At this point I'm not sure what other steps I can take to resolve the issue. Thoughts?
© Server Fault or respective owner