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: AddHandler cgi-script .cgi .pl .py
[root@monitor cgi-bin]# cat hello.py
#!/usr/bin/python
# -*- coding: UTF- -*-
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;

}

httpd cgi程序配制+.py .cgi执行的更多相关文章

  1. Apache运行python cgi程序

    Apache运行python cgi程序 环境 win10 x64 专业版 Apache2.4 python 2.7 Apache安装和配置 Apache服务器的安装请自行搜索.在Apache2.4中 ...

  2. 写一个CGI程序并运行

    准备Linux和Apache我在/var/www/cgi-bin/下建一个文件get.c #include <stdio.h> #include <stdlib.h> int ...

  3. 第一个CGI程序-----完全就是普通的c语言嘛‘(*∩_∩*)′

    第一个CGI程序 ----完全就是普通的C语言嘛  '(*∩_∩*)′ PainterQ 2017年5月14日 上一篇博文里面叙述了Apache的安装和配置方法,恍恍惚惚我就拥有了自己的第一个http ...

  4. C语言写CGI程序

    一.CGI概述 CGI(公用网关接口)规定了Web服务器调用其他可执行程序(CGI程序)的接口协议标准.Web服务器通过调用CGI程序实现和Web浏览器的交互, 也就是CGI程序接受Web浏览器发送给 ...

  5. Hello World! 这是我的第一个 CGI 程序

    Hello World! 这是我的第一个 CGI 程序上面的 C++ 程序是一个简单的程序,把它的输出写在 STDOUT 文件上,即显示在屏幕上.在这里,值得注意一点,第一行输出 Content-ty ...

  6. 使用c语言编写cgi程序

    http://blog.chinaunix.net/uid-22566367-id-3109877.html 简单的说,cgi是沟通HTML表单和服务器端程序的接口,是可以被其他语言所应用的一个规范集 ...

  7. 教你用shell写CGI程序

    以前用shell写过一些cgi的例子.今天向大家介绍一下. CGI是一种接口的标准,并不区分编程语言,也就是说,CGI可以用任何一种语言编写,只要这种语言具有标准输入.输出和环境变量.CGI会将标准输 ...

  8. 用 c 写 CGI 程序简要指南

    文章摘要:  CGI规定了Web服务器调用其他可执行程序(CGI程 序)的接口协议标准.Web服务器通过调用CGI程序实现和Web浏览器的交互.CGI程序可以用任何程序设计语言编写,如Shell脚本语 ...

  9. 配置apache运行cgi程序

    配置apache运行cgi程序 文章目录 [隐藏] ScriptAlias目录的CGI ScriptAlias目录以外的CGI 配置apache运行cgi程序可分为两种情况,一是ScriptAlias ...

随机推荐

  1. pgsql与mysql 下 varchar类型的数字文本的排序 区别

    两者都有cast函数,但使用方法完全不同. 1.在mysql中,cast( value as type) 将value的数据类型转换成type类型,其type可以为 二进制,同带binary前缀的效果 ...

  2. iOS代码实现:创建按钮,绑定按钮事件,读取控件值

    // // main.m // Hello // // Created by lishujun on 14-8-28. // Copyright (c) 2014年 lishujun. All rig ...

  3. [转]DOS命令

    windows dos命令 - 知识天地 - 博客园http://www.cnblogs.com/mfryf/archive/2012/02/13/2348685.html

  4. 机械硬盘与SSD固态硬盘性能的深度

    从7200转硬盘升级到10000转的迅猛龙,那叫量变.从10000转的迅猛龙升级到SSD,这个叫质变.2者的差距是有些地方相当大,而有些却很接近,主要是难比较. 经常听到有人说:我买2个黑盘组RAID ...

  5. utf8_to_utf16

    17down voteaccepted Here's some code. Only lightly tested and there's probably a few improvements. C ...

  6. qt5使用curl实现文件下载的示例程序 good

    http://blog.csdn.net/xueyushenzhou/article/details/51702672#t3 http://download.csdn.net/detail/xueyu ...

  7. 注意android裁图的Intent action

    现在很多开发者在裁图的时候还是使用com.android.camera.action.CROP 来调用 startActivity(). 这不是个好主意. 任何不是依android开头的Action ...

  8. php-Mysql示例1

  9. ARM 开发板嵌入式linux系统与主机PC通过串口传输文件

    本文转载自http://useless20.blog.163.com/blog/static/237409982010227127576/ 嵌入式linux系统与主机通过串口传输文件 我想如果要从PC ...

  10. House Robber II——Leetcode

    After robbing those houses on that street, the thief has found himself a new place for his thievery ...