Wildcard Subdomains

后端 未结 8 913
广开言路
广开言路 2020-12-07 15:25

I know there have been a few threads on this before, but I have tried absolutely everything suggested (that I could find) and nothing has worked for me thus far...

W

8条回答
  •  臣服心动
    2020-12-07 15:54

    I am on Ubuntu 16.04 and since 14.04 I've using solution provided by Dave Evans here and it works fine for me.

    1. Install dnsmasq

      sudo apt-get install dnsmasq
      
    2. Create new file localhost.conf under /etc/dnsmasq.d dir with the following line

      #file /etc/dnsmasq.d/localhost.conf
      address=/localhost/127.0.0.1
      
    3. Edit /etc/dhcp/dhclient.conf and add the following line

      prepend domain-name-servers 127.0.0.1;
      

      (You’ll probably find that this line is already there and you just need to uncomment it.)

    4. Last one is restart the service

      sudo systemctl restart dnsmasq
      sudo dhclient
      

    Finally, you should check if it's working.

    dig whatever.localhost
    

    note:

    If you want to use it on your web server, you need to simply change the 127.0.0.0 to your actual IP address.

提交回复
热议问题