How to put wildcard entry into /etc/hosts?

后端 未结 3 1021
自闭症患者
自闭症患者 2020-11-30 23:47

I recently wanted to point all subdomains for a test domain, let\'s say example.com to the localhost. Is there a way to point all requests on *.example.com to resolve to 127

3条回答
  •  孤城傲影
    2020-12-01 00:21

    use dnsmasq

    pretending you're using a debian-based dist(ubuntu,mint..), check if it's installed with

    (sudo) systemctl status dnsmasq
    

    If it is just disabled start it with

    (sudo) systemctl start dnsmasq
    

    If you have to install it, write

    (sudo) apt-get install dnsmasq
    

    To define domains to resolve edit /etc/dnsmasq.conf like this

    address=/example.com/127.0.0.1
    

    to resolve *.example.com

    ! You need to reload dnsmasq to take effect for the changes !

    systemctl reload dnsmasq
    

提交回复
热议问题