Implementation of virtual domain names in Linux (3)

Source: Internet
Author: User


At present, the Linux operating system is very popular, so many friends want to know about the implementation process of virtual domain names in Linux. Next we will discuss it based on the popular RedHat.
Iii. cgi Program Compilation

To apply for a virtual domain name online, you must write the corresponding CGI program to dynamically modify the independent configuration file (the above vhostdbm file) and manage users (including user application, login, password Change ). This section only describes operations on independent configuration files. For more information about how to write CGI programs in Perl, see.

The vhostdbm file uses the DBM format to record data. Compared with common text files, the file search speed is faster and easier to modify. Many Unix systems have a standard library called database management. This database stores a set of key-value pairs in a pair of disk files. It provides a simple database management tool to conveniently change, add, or delete data content.

Perl accesses dBm by connecting the associated array to the DBM database through a process similar to opening a file. When a new element is created in the array, the DBM database is changed immediately. Deleting an element also deletes the values in the DBM database. Available:

1. to associate a dBm database with a dBm array:

Dbmopen (% arrayname, "dbmfilename", $ mode );

If dbmfilename does not exist, create the database. The % arrayname parameter is an associated array of Perl (if the array already has values, these values will be deleted ). The joined array is connected to the DBM database called dbmfilename. $ Mode is the number used to control the permission of the database file when a database needs to be created. This number is specified in the 8 format and is often used in the 0644 format, read-Only permissions are granted to new users except the host. The host has all permissions.

2. Close the DBM database:

Dbmclose (% arrayname );
% Arrayname is the array name associated with the DBM database.

Example 6: Open vhostdbm in vhost or create a new dBm database:

Dbmopen (% vhost, "vhostdbm", 0644 );

Example 7: create a record or change an existing record (set the parameter names from the HTML file form to vhost and rHost ):
$ Vhost {$ FORM {'vhost' }}=$ FORM {'rhost '};

Example 8: delete an existing record (set the parameter name from the HTML file form to vhost ):
Delete $ vhost {$ FORM {'vhost '}};

Example 9. Disable vhostdbm:

Dbmclose (% vhost );

Note: If the input parameters have been verified, there are no duplicate records. Otherwise, the existing records may be confused. (Source: pconline)

Related Article

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.