Home » Howto

Wildcard su apache e bind

22 ottobre 2007 293 views No Comment

Molte volte ci troviamo di fronte alla situazione di avere una configurazione tra {it:bind} (dns) e {it:apache} (web) strettamente legati tramite wildcard (il carattere jolly *).

Questo, generalmente, avviene per i sottodomini (subdomains).

Mettiamo, per esempio, che ci troviamo di fronte a WordPress MU, sistema multi-blog basato su wordpress.

In pratica, abbiamo bisogno che bind nomini tutti i sottodomini del tipo utente1.domain.com, utente2.domain.com, utenteX.domain.com…etc.

Di seguito esplicito la configurazione per un fittizio dominio domain.com in modo che accetti tutti i sottodomini del dominio puntando allo stesso IP della macchina:

*.domain.com. IN A 192.168.1.1

Ovvero, completo:

domain.com. 86400 IN SOA domain.com. hostmaster.domain.com. (
2005100804 ; Serial YYYYMMDDXX
10800 ; Refresh
3600 ; Retry
3600000 ; Expire
86400 ) ; minimum
IN NS ns1.domain.com.
IN NS ns2.domain.com.
IN MX 10 mail.domain.com.
IN A 192.168.1.1
mail IN A 192.168.1.1
ns1 IN A 192.168.1.1
ns2 IN A 10.0.0.2
*.domain.com. IN A 192.168.1.1

Per apache, basta impostare la wildcard a livello di virtualhost:

ServerName www.domain.com
ServerAlias *.domain.com

DirectoryIndex index.html
DocumentRoot /home/www/www.domain.com/htdocs

….

Et voilà, il gioco è fatto :)

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.