Sub.domain now I know

November 28, 2007

Eventually have my subdomains setup correctly last night. Subdomain using namebased virtualhost is like an ordinary domain therefore the key is setting the DNS records right.

Say you want to have these sites

mysite.net and *.mysite.net

habari.mysite.net running Habari at folder /var/www/habari

wp.mysite.net running WordPress at folder /var/www/wp

You’ll need DNS setup below (in the case of Slicehost)

mysite.net (name) my.own.ip.no (data) A (type)

mysite.net (name) ns3.slicehost.net (data) NS (type)

mysite.net (name) ns2..... (data) NS (type)

mysite.net (name) ns1..... (data) NS (type)

www (name) my.own.ip.no (data) A (type)

wp.mysite.net (name) mysite.net (data) CNAME (type)

habari.mysite.net (name) mysite.net (data) CNAME (type)

One other setup which may also be key is to add (create if it’s not there) below lines to this file /etc/apache2/conf.d/virtual.conf.

#

# enable multiple virtual hosts

#

NameVirtualHost *

Also the first line #NameVirtualHost * in all site config files stored under /etc/apache2/sites-available should also be commented out.

Last night I also have Shorewall installed, transferred content from this site using WXR export to that WP test site. During import found that I have chmod 777 . folder /wp-content/ such that the uploads folder can be created by the import script.

May be my apache or mysql aren’t properly optimized yet as I found out from stat at SliceManager that CPU was running flat out. I did a soft reboot and it’s now back to normal. free -m gave me 88M used out of 256 which is weird as I remember seeing a lot more consumed last night.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: