FreeBSD Server Administration

« Create MySQL User | Main | register_globals »

January 14, 2005

Complete Steps to Add a Website

To add a new website on FreeBSD, here is the complete procedure, that's what CPanel does when creating a new account. All commands are executed by root account.

1. Add a new user (test_user), the new user will have ftp permission automatically.
# adduser

2. Add the new domain to bind. (test_domain.com)
2.1 Insert a zone entry into /etc/namedb/named.conf:

zone "test_domain.com" {
type master;
file "test_domain.com.db";
};

2.2 Create a new zone file test_domain.com.db under /etc/namedb/. It looks like:

$TTL 14400
@ 14440 IN SOA ns1.yourdns.com. admin.test_domain.com. (
2004102903
14400
7200
3600000
86400
)

test_domain.com. 14400 IN NS ns1.yourdns.com.
test_domain.com. 14400 IN NS ns2.yourdns.com.
test_domain.com. 14400 IN A 1.2.3.4

localhost.test_domain.com. 14400 IN A 127.0.0.1
test_domain.com. 14400 IN MX 0 test_domain.com.
mail 14400 IN CNAME test_domain.com.
www 14400 IN CNAME test_domain.com.
ftp 14400 IN A 1.2.3.4

2.3 Restart bind
# /etc/rc.d/named restart

3. Add a virtual host entry to Apache config file /usr/local/etc/apache/httpd.conf, it looks like this:

# If IP 1.2.3.4 hosts multi-sites, must have the NameVirtualHost line
NameVirtualHost 1.2.3.4
<VirtualHost 1.2.3.4>
ServerAlias www.test_domain.com test_domain.com
ServerAdmin admin@test_domain.com
DocumentRoot /home/test_user/www
ServerName www.test_domain.com
</VirtualHost>

Restart Apache
# /usr/local/sbin/apachectl restart

4. Add database and database user for test_user.
Refer to last post.

5. Add email address.
Pending.


Category : FreeBSD General

Posted by FreeBSD Newbie at January 14, 2005 02:42 AM

Comments

Post a comment



(Optional, will not be shown to the public)

Remember Me?