zoukankan      html  css  js  c++  java
  • httpd cgi程序配制+.py .cgi执行

     vi /etc/httpd/conf/httpd.conf

    httpd默认首页配制:

    DirectoryIndex index.html index.html.var


    首页的位置定义:

    DocumentRoot "/var/www/html"


    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 ");

    printf("Hello CGI ");



    return 0;

    }

  • 相关阅读:
    UVa 727
    UVa 11495
    UVa 299
    UVa 10194
    UVa 146
    10025
    Tug of War POJ 2576 DP(类似背包)
    Problem A: Freckles UVA 10034 裸生成树
    UVA 562
    CF DIV 2 206 C. Vasya and Robot
  • 原文地址:https://www.cnblogs.com/zengkefu/p/5573001.html
Copyright © 2011-2022 走看看