标签:
vi /etc/httpd/conf/httpd.conf
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" <Directory "/var/www/cgi-bin"> AllowOverride None Options +ExecCGI Order allow,deny Allow from all </Directory> ServerName localhost:80 AddHandler cgi-script .cgi .pl .py
[root@monitor cgi-bin]# cat hello.py #!/usr/bin/python # -*- coding: UTF-8 -*- print "Content-type:text/html" print print ‘<html>‘ print ‘<head>‘ print ‘<meta charset="utf-8">‘ print ‘<title>Hello Word - 我的第一个 CGI 程序!</title>‘ print ‘</head>‘ print ‘<body>‘ print ‘<h2>Hello Word! 我是来自菜鸟教程的第一CGI程序</h2>‘ print ‘</body>‘ print ‘</html>‘
gcc test.c -otest.cgi
[root@monitor cgi-bin]# cat test.c
#include <stdio.h>
int main(void)
{
printf("Content-Type: text/html;charset=gb2312\n\n");
printf("Hello CGI\n");
return 0;
}
标签:
原文地址:http://www.cnblogs.com/zengkefu/p/5573001.html