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;

    }

  • 相关阅读:
    To be a master II.
    To be a master.
    快速排序
    选择排序
    冒泡排序
    Myeclipse 2013 Pro 激活工具
    Java多线程
    设计模式:动态代理
    面向对象
    新安装mysql修改密码,远程访问授权
  • 原文地址:https://www.cnblogs.com/zengkefu/p/5573001.html
Copyright © 2011-2022 走看看