CGI script installation in Win2000 and winnt
(Download this tutorial)
I. Preparations
- Install IIS, which is an Internet Information Service component
- Install the instmsi.exe Program
- Install ActivePerl
- Set virtual directory
- Ing. cgi or. pl in the IIS web server of WINNT/2000
Ii. Install CGI script |
|
I. Preparations
Make the following preparations before installing the CGI script. Otherwise, the script cannot run properly.
1. Install IIS, the Internet Information Service component
If you are installing CGI scripts on win2000 sever or WINNT sever, skip this step because they already come with IIS.
If you are using Windows 2000 Professional, start with this step. Because Windows 2000 Professional does not have Internet Information Service (IIS) installed by default, you must install IIS first.
In addition, if the system is upgraded to Windows 2000, IIS 5.0 will be installed by default only when PWS is installed in earlier versions of Windows.
If you do not know whether your system has IIS, how can you differentiate them? There are two methods:
Method 1) Go to "Control Panel" = "management" = "and check whether" IIS Management Tools "exist ".
Method 2) Go to "Control Panel" = "" Add/Delete"Program"=" Windows Components "to check whether IIS is installed.
Installation steps:
1.1. "My Computer" = "Control Panel =" Add/delete Programs = "Add/delete Windows Components =" select "Internet Information Service (IIS) click "Next" in the box = "Next" and follow the prompts to install IIS.
1.2 after IIS is installed, open IE, enter http: // your-domain/in the address bar, and press enter to confirm. The Microsoft IIS page appears, proving that IIS is successfully installed.
2. Install the instmsi.exe Program
If it is in Win2000, skip this step.
If it is in WINNT, please do this step. In NT, you must first install the Windows Installer (installer for the Windows Installer) instmsi.exe; otherwise, the next ActivePerl installation cannot be performed.
2.1. Obtain the Windows Installer instmsi.exe For WinNT.
There are two ways to obtain instmsi.exe:
- Find the instmsi.exe file on the WINNT installation disc.
- Download the instmsi.exe Program For WinNT to the hard disk
: Http://activestate.com/Products/ActivePerl/index.html
Http://download.microsoft.com/download/WindowsInstaller/Install/2.0/NT45/EN-US/InstMsi.exe
2.2、double-click instmsi.exe and install it as prompted.
2.3. restart the computer.
3. Install ActivePerl
3.1 download ActivePerl to Hard Disk
Foreign download: http://www.activestate.com/
Download in China:Http://www.onlinedown.net/ActivePerl.htm
3.2 install ActivePerl. Double-click it and follow the prompts (you can select an installation path ).
The system will prompt you to select four installation configurations:
3.3 After ActivePerl is installed, restart the computer.
4. Set a virtual directory
Under the default settings of IIS, under the inetpub directory under the root directory of the system, there is a directory scripts for storing executable scripts. However, the ISP may also modify the IIS settings. Therefore, we need to create and set up an executable virtual directory for storing the CGI script to be run.
4.1 create a folder (with any name) under any path of the hard disk ).
For example, F: \ cgi-bin. Create a folder named cgi-bin under drive F.
4.2 open the IIS server
From "start" = "" Settings "=" "Control Panel" = "Administrative Tools" = "Internet Service Manager"
The IIS interface appears.
4.3 create a virtual directory
Double-click your computer name "pC1", expand its site directory = "on your web site name (here is" Default web site ") right-click = "new" = "virtual directory"
The "virtual directory creation wizard" () = "appears, click" Next"
Enter a name in the "alias" box to represent the CGI script directory (here "cgi-bin") to be mapped ". Of course, you can also use any other name, such as ABC and 123) = "click" Next"
In the "directory" box, enter the physical path "F: \ cgi-bin" of the new folder generated in step 1 (or click "Browse" to find it) = "click" Next"
Select "Run (for example, ISAPI application or cgi) (E)" = "and click" Next"
Click "finish ".
Now, you have successfully created an executable CGI script directory for your site: F: \ cgi-bin. In this way, in the future, your cgi script can be run in this directory.
5. ing. cgi or. pl in the IIS web server of WINNT/2000
The IIS4 server can run Perl and CGI programs, but it is not set to run Perl by default. Therefore, you have to make two modifications: ing. CGI or. pl to Perl, that is, build. CGI or. associate PL files with files in Perl programs; Add a new NTFS license to the IUSR _ Network Customer Account.
5.1 open IIS
5.2 select and open your web site
Click your virtual web site (for example, the default web site, or xxx.com) to open it.
Select your cgi script directory (for example, the cgi-bin you just created ). If you want to apply the modification to the entire virtual web site, you only need to select a single directory and select the entire site.
5.3 open and modify directory attributes
Right-click the "=" attribute on the folder.
In the "properties" dialog box, click "directory" or "virtual directory" tab = "Select the" script and executable programs "option =", and click "Configure ".
5.4 add or edit a Perl ing to Perl
A list of available 'application mappings 'appears. Search for. cgi or. pl in the extension of the 'Application mappings' list.
1) if the two extensions cannot be found. Click "add" to create a new ing for. pl.
The "Add/edit application extension" window appears.
In the "executable file (x)" box at the top of the window, use the "Browse" button to find perl.exe or Perlis on your computer. DLL, which finds the complete path to the Perl program, such as D: \ Perl \ bin \ perl.exe or D: \ Perl \ bin \ Perlis. DLL. If you find D: \ Perl \ bin \ perl.exe, please add [space] % s [space] % s after this path.
Enter ". pl" in the "extension" box (If You Want To map. pl as the extension), note that there is a decimal point before Pl.
2) If you can find it in the 'Application mappings 'list. CGI or. pl, but the executable file path does not have a suffix such as "% S % s". Select it and click "edit ". Then, add "space" % s "% s" to the path, as shown in.
3) deselect the check box before "Script Engine" and "check whether a file exists.
4) set the allowed request method for. pl ing:
In WINNT (IIS4), empty the "method exclusions:" (exclusion method) box.
If it is in Win2000 (iis5), enter the uppercase "Get, Head, post" in the "Limited" box under "action". Note the comma between them.
Is an example of. pl ing that has been set in the "Application ing" list.
If you still need to map the. cgi extension to Perl, redo the above steps.
Click "OK" = "OK" = "Close Window =". If you ask "Save console settings to IIS ?", Click "yes ".
5) restart the computer
At this point, you have prepared an executable Script directory (F: \ cgi-bin) for the CGI script and correctly mapped the. pl extension to ActivePerl. It can be said that the preparation for installing CGI script in Win2000/nt iis is complete. Next, you can easily install and run the CGI script.
Ii. Install CGI script
1. Copy your cgi script (if the script is compressed, decompress it first) to the directory F: \ cgi-bin generated in 4.1.
2. Change the script extension to. pl or. cgi that you have mapped to ActivePerl.
3. If the script requires some special installation steps, follow the installation instructions.
Note: If you need to change the script and set its parameters, open it on the WordPad.
4. Open your browser and enter URL: http: // your-domain/cgi-bin/XXX in the address bar. pl, xxx here. PL is your script name. You can access this script.