免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 10379 | 回复: 4
打印 上一主题 下一主题

哪位嵌入式系统用的是mini_httpd,请教配置问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-02-15 17:47 |只看该作者 |倒序浏览
因为我想web+cgi+ssl,起初选用了thttpd,结果配SSL支持麻烦得很,听说mini_httpd可以,想换成它来做,但是遇到两个问题,请指教:

1、运行CGI程序,报500 内部错误,不论是用-c cgi-bin/* 还是在配置文件中指明cgipat=XXX均是如此,我的CGI用的是C编写,权限位是三个可运行,以前用thttpd跑,没有问题的;

2、想用SSL支持,结果不论是-Y,还是配置文件中指明cipher,程序都报怨说不认识,是不是编译时要有什么开关之类的?

盼哪位大哥指点小弟,以解燃眉之急!

论坛徽章:
0
2 [报告]
发表于 2006-02-15 18:19 |只看该作者
修改Makefile文件, 把SSL支持部分的注释去掉;还有一个mini_httpd.conf文件, 把ssl那行的注释去掉, 运行时用./mini_httpd -C mini_httpd.conf表示后面那个是它的配置文件。
应该可以了,我没试过

论坛徽章:
0
3 [报告]
发表于 2006-02-15 19:34 |只看该作者
[quote]

2、CGI的问题呢?难道不支持用C写的CGI还是要做什么另外的配置呢?现在是:
500 Internal Error
Something unexpected went wrong running a CGI program.

第2点问题已解决,原因是自身操作上面的原因,原来命令是:
mini_httpd -d /var/web -c /cgi-bin/* -h 0.0.0.0 -u root -i /var/run/mini_httpd.pid -T GB2312 -r

即进行chroot()

现在换成:
mini_httpd -d /var/web -c cgi-bin/* -h 0.0.0.0 -u root -i /var/run/mini_httpd.pid -T GB2312

可以运行CGI程序了,只是程序启动时报怨:
mini_httpd: started as root without requesting chroot(), warning only
暂时没有找到解决办法。

关于第1点,打开SSL开关后,程序编译时,出现
/usr/include/openssl/kssl.h:72:18: krb5.h: No such file or directory
……
在kssl.h中,有#include <krb5.h>,不知是否是我的系统上默认没有这个问题造成的,解决中……

[ 本帖最后由 独孤九贱 于 2006-2-15 20:56 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-02-15 22:23 |只看该作者

自己搞定,发上来,已做备忘之用

自己搞定,贴上来,以做备忘之用
独孤九贱 2006-02-15 22:25

# Redhat Linux 9.0(2.40.+mini_thttpd 1.19(+SSL+CGI)

1、打开Makefile中的SSL标志;
2、修改SSL_TREE =      /usr/share/ssl
3、在Shell中输入:
        export LOCALDEFS="-DOPENSSL_NO_KRB5"
        export C_INCLUDE_PATH="/usr/kerberos/include"
4、编译:make;make install
5、make cert 生成mini_httpd.pem,再拷贝到/etc下
6、建立配置文件/etc/mini_httpd_config

#The -D flag tells mini_httpd to *not* put itself into the background
debug

# Specifies a directory to chdir() to at startup.
dir=/var/web

# Specifies an alternate port number to listen on
port=8887

# CGI programs path
cgipat=cgi-bin/*

# Specifies a hostname to bind to
host=0.0.0.0

# Specifies what user  to  switch  to  after  initialization  when started  as  root.
user=root

# pid file path
pidfile=/var/run/mini_httpd.pid

# log file path
logfile=/var/log/mini_httpd.log

# Specifies the character set to use with text  MIME  types.
charset=GB2312

# It is available  to  enable SSL/HTTPS feature.
ssl

# Specify  a  server  certificate with this flag.
certfile=/etc/mini_httpd.pem

运行:
mini_httpd -C /etc/mini_httpd_conf

也可以用源码下的scripts下的两个脚本来管理启动

未解决的问题:

没有使用-r 进行chroot(),因为我的CGI程序要常常去访问根文件系统中的某些文件和库文件,如果使用了-r,会让CGI程序无法运行;
问题是:
A、使用了-r,如何让CGI程序正常运行,包括日志记录至根文件系统的指定文件中;
B、不使用-r,如何关闭程序的
/usr/local/sbin/mini_httpd: started as root without requesting chroot(), warning only
报怨语句

[ 本帖最后由 独孤九贱 于 2006-2-15 22:24 编辑 ]

评分

参与人数 1可用积分 +15 收起 理由
T-bagwell + 15 精品文章

查看全部评分

论坛徽章:
0
5 [报告]
发表于 2009-03-11 16:02 |只看该作者

回复 #4 独孤九贱 的帖子

很有用,非常感谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP