How to develop a virtual domain name system

Source: Internet
Author: User
It is very convenient for everyone to apply simple domain names such as yourname.yeah.net. many people are wondering: if I can enable my server to implement simple domain names. This is not complicated. After reading this article, you can also easily create a simple domain name such as yourname.yeah.net. many people are thinking: it would be nice if I could enable my server to implement a simple domain name. This is not complicated. After reading this article, you can also create a simple domain name system.

The key skill of the domain name system is to achieve webpage redirection (Redirctory ). In essence, the domain name system and the virtual machine system are completely different. The virtual domain names and IP addresses of virtual machines correspond one by one. The simplified domain name system does not need to map domain names and IP addresses one by one. That is to say, it basically does not need complicated domain name resolution mechanisms and virtual machines to complete. what it does is when you are begging for yourname. in somedomain, redirect your browser to the location where you originally stored the Html page.

The following example shows how to better illustrate the problem:

The source program I provided is the runtime environment: Apache1.3.6 Web server PHP3 language in RedHat 5.1 Linux. Before writing a program, we must first set up our server. First, let the Apache server support php3. Go to ftp.redhat.com to download the mod_php-2.0.1-9.i386.rpm, after installation, fix/etc/httpd/conf/http. in the conf file, remove the # Comment # in front of the # LoadModule php3_module statement, also in/etc/httpd/conf/srm. # AddType application/x-httpd-php3. comment number before php3, and add index after DirectoryIndex. php3. Restart Apache Server. now the Server supports the php3 script file and uses index. php3 as the default homepage.
Set the DNS server so that it can resolve wildcard domain names. Generally, DNS resolution for Unix and Linux systems is completed by the Bind daemon. the Bind4 and Bind8 configuration files are distinguished by/etc/named. boot and name. conf, which is modified according to your system during configuration. Set the Bind configuration file/etc/named. boot and add a new domain record in the "primary domain.com db. domain" clause. In/etc/name. conf:

Zone 'domain. com '{
Type master;
File 'DB. domain ";
};
Create the master domain record file db. domain in/var/name/. the pattern is:
N soa dns.domain.com root.domain.com (
199811291; Serial
28800; refresh
7200; retry
604800; expire
86400); minimum
Dns
MX 10 dns.domain.com.
Dns A 202.115.135.50
Www A 202.115.135.50
* A 202.115.135.50
The key is the last sentence, that is, all hostnames in all fields may point to the same IP address. Perform/usr/sbin/ndc reload and reload the domain name database. In this test, you should ping a host in the domain (except the host that has been marked) and point to the specified IP address. then, the DNS server settings are complete.


The last step is to compile the PHP3 script. We have already explained all the principles in the figure, so it is not difficult to write a retargeting program.


Let's take a look at the complete HTTP header information sent by IE5.0:


Accept: application/vnd. ms-excel, application/msword, application/vnd. ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg ,*/*

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.