由于公司原有的mini_httpd不能同时支持http/https,所以,必须选择新的web 服务开源软件。在网上对比了,最终选用lighttpd这个德国人的开源,这个软件相对符合我们产品的需求。
1.下载lighttpd-1.4.32.tar.bz2
2.解压编译配置
CC=arm-linux-gcc AR=arm-linux-ar LD=arm-linux-ld RANLIB=arm-linux-ranlib STRIP=arm-linux-strip ./configure --prefix=/usr/local/lighttpd --host=i686-pc-linux-gnu --build=i686-pc-linux --disable-FEATURE --enable-shared --disable-static --disable-lfs --disable-ipv6 --without-PACKAGE --without-valgrind --with-openssl --with-openssl-libs=/usr/src/openssl-1.0.1e/ --with-openssl-includes=/usr/src/openssl-1.0.1e/include --without-kerberos5 --without-pcre --without-zlib --without-bzip2
这儿一定要增加openssl的指定和支持。
make
make install
3.把lighttpd.conf modules.conf 配置,和conf.d 里的cgi.conf做对应的修改
lighttpd.conf里注意增加.cgi的支持
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi", ".cgi")
modules.conf里把
include "conf.d/cgi.conf"
打开,做为支持
cgi.conf里把
cgi.assign = (".cgi" => "")
这个修改进去。
把修改后的配置文件,lib 和应用程序加到rootfs里
把生成的.pem文件也放到指定的目录下,以备https校验用。
把测试的cgi,html文件放到对应的目录下,以备测试。
打包测试,http/https都能正常访问,这只是通过简单的测试,接下去的几天,还要改为软件架构的正常应用。
开发过程中,遇到问题,并记录如下:
1.无法支持https,没有编译进去。解决方法:配置lighttps时,要指定inclue配置项,网上文档有大量错误。
2.lighttpd: can't resolve symbol 'EVP_md2'错误 ,解决方法:openssl配置时要增加enable-md2选项。
3.出现段错误,解决方式:重新用openssl1.0.1e版本,更新libssl.so和libcrypto.so
4.无法访问cgi,原因是cgi用ftp传入后,是不可执行的,最好是能过打包方式,在包里改为可运行属性。
5.证书无法有效问题,这个要把证书列为可信任发证商。
openssl的配置和编译,也花了大量的时间,以后有空,也把这个列出来,以备记录。