Monday, August 31, 2015
Configure httpd to use Perl as CGI Scripts.
First we need to Install Perl.
[root@easylinux ~]# yum -y install perl perl-CGI
[2] Configure httpd.
[root@easylinux ~]# vi /etc/httpd/conf/httpd.conf
# line 576: by default, it is allowed to use CGI scripts under the "/var/www/cgi-bin/".
# but all files under it is looked as CGI by default.
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
# if you use CGI scripts under any directory and specify files for CGI, add settings like follows
# line 331: change ( enable CGI, remove Indexes )
Options FollowSymLinks ExecCGI
# line 796: uncomment and add extentions for CGI
AddHandler cgi-script .cgi .pl
[root@easylinux ~]# /etc/rc.d/init.d/httpd restart
Stopping httpd:
[ OK ]
Starting httpd:
[ OK ]
[3] Create a CGI test page and access to it with a web browser on Client to make sure it works normally.
[root@easylinux ~]# vi /var/www/html/index.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html>\n<body>\n";
print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n";
print "CGI Test Page Easy linux";
print "\n</div>\n";
print "</body>\n</html>\n";
[root@easylinux ~]# chmod 705 /var/www/html/index.cgi
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment