1.安装mini_httpd

1.1把下载的mini_httpd-1.19.tar.gz拷贝到根目录
   1.2 解压tar -xvfzmini_httpd-1.19.tar.gz ,会在根目录产生一个目录mini_httpd-1.19
   1.3 cd /mini_httpd 目录 make,会出错, htpasswd.c中的getline函数,换个名字get_line就行
   1.4 make install

/usr/local/sbin/mini_httpd-V
   会输出:/mini_httpd-1.19

1.5 安装成功

2.配置mini.conf ,主要是为客户端通过CGI与服务器通信用

先在根目录下建一个web目录,在web目录下建个子目录html,conf内容如下:

nochroot
user=root
#port=8080
dir=/web/html
cgipat=**.cgi
pidfile=/web/mini_httpd.pid
logfile=/web/mini_httpd.log
charset=UTF-8

root@long:/web#mini_httpd  -C /web/mini.conf -TUTF-8   //infomini_httpd可以了解
bind: Address already in use
mini_httpd: started as root without requesting chroot(), warningonly
上面警告,但是mini_httpd已经启动

3.测试mini_httpd  cgi测试

#include <stdio.h>
#include <unistd.h>

void main()
{
       printf("Content-type: text/html;charset=gb2312\n\n");
//注意这里要两个换行符,这是HTML的规定
       printf("\n");
       printf("<html><head><title>CGITEST</title></head>");
       printf("<body>");
       printf("<h1>BOA CGITEST</h1>");
       printf("<h2>huyi</h2>");
       printf("Hello\n");
       printf("</body></html>");
}

用gcc -o test.cgi test.c 生成test.cgi

把生成的test.cgi拷贝到/web/html下面

在客户端浏览器输入:http://192.168.1.250/test.cgi

会输出:

BOA CGI TEST

huyi

Hello

=================================================================================

1、下载:http://www.acme.com/software/mini_httpd/mini_httpd-1.19.tar.gz

2、解压:tar zxvf mini_httpd-1.19.tar.gz

3、编译,安装:cd mini_httpd-1.19

make

make install

4、建立存放网页和cgi的目录:mkdr mini

mkdir mini/wwwroot

mdir mini/wwwroot/cgi-bin

5、写配置文件:vim mini/mini_httpd.conf

内容:

port=8080
dir=/home/XXX/mini_httpd-1.19 /mini/wwwroot
cgipat=cgi-bin/*
user=nobody
pidfile=/home/XXX/mini_httpd-1.19 /mini/mini_httpd.pid
logfile=/home/XXX/mini_httpd-1.19 /mini/mini_httpd.log

6、把网页放在wwwroot下

7、打开mini_httpd:/usr/local/sbin/mini_httpd -C /home/XXX/mini_httpd-1.19 /mini/mini_httpd.conf

8、在浏览器里打开localhost:8080即可访问

minihttp http://www.acme.com/software/mini_httpd/的更多相关文章

  1. MINI_httpd移植,构建小型WEB服务器

    一.简介 目的:构建小型WEB站,具备SSL. mini_httpd is a small HTTP server. Its performance is not great, but for low ...

  2. mini_httpd在RedHat 5下安装

    1.安装mini_httpdcd /usr/src/redhat/SOURCES wget http://www.acme.com/software/mini_httpd/mini_httpd-1.1 ...

  3. mini_httpd的安装和配置

    1.下载:http://www.acme.com/software/mini_httpd/mini_httpd-1.19.tar.gz 2.解压:tar zxvf mini_httpd-1.19.ta ...

  4. 【转】推荐介绍几款小巧的Web Server程序

    原博地址:http://blog.csdn.net/heiyeshuwu/article/details/1753900 偶然看到几个小巧有趣的Web Server程序,觉得有必要拿来分享一下,让大家 ...

  5. 六款小巧的HTTP Server[C语言]

    1.micro_httpd - really small HTTP server特点: 支持安全的 .. 上级目录过滤 支持通用的MIME类型 支持简单的目录 支持目录列表 支持使用 index.ht ...

  6. 嵌入式web服务

    :boa.thttpd.mini_httpd.shttpd.lighttpd.goaheand.appweb和apache等. Boa 1.介绍 Boa诞生于1991年,作者Paul Philips. ...

  7. 嵌入式设备web服务器比较

    目录(?)[-] Boa Thttpd Mini_httpd Shttpd Lighttpd Goahead AppWeb Apache 开发语言和开发工具 结论 备注   现在在嵌入式设备中所使用的 ...

  8. mini-httpd源码分析-mini-httpd.c之外总结

    version.h #define SERVER_SOFTWARE "mini_httpd/1.21 18oct2014" #define SERVER_URL "htt ...

  9. mini-httpd源码分析-version.h

    /* version.h - version defines for mini_httpd */ #ifndef _VERSION_H_ #define _VERSION_H_ #define SER ...

随机推荐

  1. 手游设备ID

    android: imei: IMEI(International Mobile Equipment Identity)是国际移动设备标识的缩写,IMEI由15位数字(英文字母)组成. mac: 是指 ...

  2. NOIP1998 拼数

    http://www.luogu.org/problem/show?pid=1012 题目描述 设有n个正整数(n≤20),将它们联接成一排,组成一个最大的多位整数. 例如:n=3时,3个整数13,3 ...

  3. 如何创建下拉列表为一个树列表?(此文为dev控件中,服务器控件暂不知,但想方法应该都差不多吧)

    //前端控件代码:<dx:ASPxDropDownEdit ID="drop_treelist" runat="server" ClientInstanc ...

  4. git大百科

    1,命令: git忽略提交文件:git rm --cache .idea/workspace.xml 因为你已经把他加到tracked file里了 用 git rm --cached java/.i ...

  5. JS判断对象是否存在的方法

    Javascript语言的设计不够严谨,很多地方一不小心就会出错. 举例来说,请考虑以下情况. 现在,我们要判断一个全局对象myObj是否存在,如果不存在,就对它进行声明.用自然语言描述的算法如下: ...

  6. undefined reference to `pthread_create'问题解决

    在编译pthread有关的程序时,出现undefined reference to `pthread_create'这样的错误. 问题原因: pthread 库不是 Linux 系统默认的库,连接时需 ...

  7. 装逼利器之DLog -DEBUG

    #ifdef DEBUG #define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __L ...

  8. c#中判断对象为空的几种方式(字符串等)

    (1)先了解几个与空类型相关的关键字和对象  Null : 关键字表示不引用任何对象的空引用,它是所有引用类型变量的默认值,在2.0版本之前也就只有引用变量类型可以为null,如(string a=n ...

  9. C# 和 Unix 时间戳转换

    unix时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒. /// 时间戳转为C#格式时间 private DateTime GetTime(string timeSt ...

  10. phpMyAdmin提示“Access denied for user 'root'@'localhost' (using password: NO)”的解决办法

    一.错误内容 在用thinkPHP登陆phpMyAdmin时遇到以下错误 #1045 - Access denied for user 'root'@'localhost' (using passwo ...