ryy705
ryy705

Reputation: 11

How can I set up sub domains on a ubuntu machine

I am trying to setup WordPress multi site on my ubuntu 10.04 laptop with apache2.

For normal WordPress installs in create an entry in the /etc/hosts file and create virtual hosts entry in /etc/apace2/sites-available directory and then soft link it to sites-enabled directory.

For example:

 NameVirtualHost *:80
 <VirtualHost *:80>
      ServerAdmin webmaster@localhost
      ServerName mysite.com
      #We want to be able to access the web site using www.dev.example.com or dev.example.com
      ServerAlias mysite.com
      DocumentRoot /home/myhome/Sites/public_html/mysite.com
      #if using awstats
      ScriptAlias /awstats/ /usr/lib/cgi-bin/
      #we want specific log file for this server
      CustomLog /var/log/apache2/example.com-access.log combined
 </VirtualHost>

But this method does not work with sub domains. What do I have to change so all sub domains point to my installation as well? I thank you in advance.

Upvotes: 1

Views: 877

Answers (2)

T4u
T4u

Reputation: 291

Have you tried checking your entire httpd.conf syntax? "apachectl confitest".

Have you tried restarting apache? "sudo apachectl restart".

Have you tried checking if the subdomains really point to your server's ip? - ping domain.com - ping subdomain.domain.com

Check the ip's. if they're different, then you have to update your subdomains dns configurations.

If that doesn't help, it would be helpful if you could tell us what exactly happens when you get into the subdomain. Do you get a different output then expected? does it not even connect?

Upvotes: 0

Ajoy
Ajoy

Reputation: 230

take a look at the virtual hosts entry, there should an attribute similar to one below :

ServerName www.domain.tld

ServerAlias domain.tld *.domain.tld

that should take care of the sub-domains

Upvotes: 2

Related Questions