Wildcard in DNS & Apache - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Linux Server Administration (https://www.linux-noob.com/forums/forum-8.html) +--- Forum: DNS and DHCP (https://www.linux-noob.com/forums/forum-84.html) +--- Thread: Wildcard in DNS & Apache (/thread-2817.html) |
Wildcard in DNS & Apache - hijinks - 2005-02-25 Here is a nice idea for people that have like webhosting or just run any websites with subdomains. Also i often type a url like ww.domain.com. So a wildcard will catch any not matched dns entry and point it to a IP. Say I have this simple dns zone file Code: NS ns1.domain.com. Now I add the following to the end of the zone file for the wildcard Code: *.domain.com. IN A 66.111.22.33 Now reload named. Code: service named reload So that will take all random subdomains people may try and then send them to the IP of my webserver for example. We can easily test that Code: [root@web1 named]# host bla.domain.com So now that bind is all setup we need to do the same for apache. You need to have your virtualhosting setup in apache for this to work So we add the following simple section at the bottom of the httpd.conf file Code: <VirtualHost 66.111.22.33> That is very simplified.. so you can always add more entries if needed like the logs or such. Now just restart apache Code: service httpd restart Now you should be able to enter ww.domain.com into your browser and it should take you to your website. |