If you are running an Apache Web server on a DSL or faster link, you can become a hosting provider for other people. You can even host their domains, without needing an IP for each domain. This is called virtual hosting, and you'd be surprised at how easy it is. Remember, some access providers have rules against running hosting services, check your hosting agreement for more information.
Register a Domain
The first thing that needs to happen is you need to register a domain at Internic or Register.com. Follow the instructions at these sites (links on the right), to register your new domain. If you're creating this for a customer, you can have them register the domain or you can do it yourself.
Domain Name Service
This is the hardest part. If you don't host your own DNS, you'll need to contact your hosting provider to have the new domain added to the DNS server. If you're hosting your own DNS this consists of:
- edit Bind or NameD or DNS to add the new domain name
- point it to the IP of your virtual hosting server
- restart your DNS service
Apache Configuration
Once you have the DNS pointing to your virtual domain server, you need to tell your Web server where to find the Web files for the domain. The way Apache works, if you have set up virtual domains, the first domain entered is the default. This is the directory that will be displayed when a virtual domain is not listed in the configuration. (In other words, if the DNS entry made above sends the URL to your IP, but you don't have the virtual host in your httpd.conf file.)
An Example
You have bought the domain www.adogslife.com and you want to host it at the hosting service with the IP 10.1.1.1 (which you also own).
DNS is set up to point to that IP.
Now you must edit your Apache httpd.conf file:
- Go to the section of the httpd.conf file on Virtual hosting (sometimes it's in srm.conf)
- Make sure that the NameVirtualHost points to your IP:NameVirtualHost 10.1.1.1
- The first virtual host entry should be your default domain:
ServerName www.defaultdomain.com
DocumentRoot /www/domain - Then list the new domain, with any options you'd like to add:
ServerName www.adogslife.com
DocumentRoot /www/dogslife
ErrorLog logs/adogslife.com-error_log
TransferLog logs/adogslife.com-access_log
Note, I added two lines to the second virtual host. These allow you to separate out the Error and Transfer logs for the new domain from your default domain. If you are going to host virtual domains for other people, they will almost certainly want their server logs, and this makes it easy to provide that to them as well.
1 $type={blogger}:
Post a Comment