lighttpd 服务器搭建过程记录2【with CGI】
来源:互联网 发布:淘宝生产许可证 编辑:程序博客网 时间:2024/05/16 07:12
1、 补上 pcre 的安装
因为要配置cgi,需要这个库。
如果可以使用yum,则非常简单,使用 yum install pcre-deve 即可!!!!
如果不可以也没关系,下载官网的,随便一个版本吧。 下载解压,执行 confiure 和 make 和 make install 即可
。详细的过程参考:http://chenzhou123520.iteye.com/blog/1817563
2、 按照好 pcre 后, 还是得把 lighttpd 重新安装一遍,在 执行 confiure 的时候不要加 without-pcre 了。
3、修改配置
把 lighttpd.conf modules.conf cgi.conf 里面支持 cgi 的都配置下。
比较关键的是:
1)lighttpd.conf 里面
原来是: static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi )
现在是:static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi",".cgi" )
2)cgi.conf 里面
原来是: ##$HTTP["url"] =~ "^/cgi-bin" {
cgi.assign = ( "" => "" )
现在是:
$HTTP["url"] =~ "^/cgi-bin" {
cgi.assign = ( "" => "" )
4、编写cgi 程序
在 htdocs 下建立 目录 cgi-bin , 后面的程序都放在 这个里面,且后缀改为 .cgi。
1)C 语言的例子
一个C语言的demo:[是 \n ,不是/n] 非常重要!!!!
#include <stdio.h>
int main()
{
printf("content-type:text/html\n\n");
printf("<html>");
printf("<head><title>file</title></head><body>");
printf("Hello,world by CGI!<br/>");
printf("</body></html>");
}
2)shell 的例子
一个shell 的dmeo:
#! /bin/bash
echo Content-type: text/html
echo ""
echo Hello, World by bash!
5、执行 127.0.0.1:8080/cgi-bin/hello.cgi
即可!
- lighttpd 服务器搭建过程记录2【with CGI】
- lighttpd 服务器搭建过程记录
- 搭建一个轻量级服务器环境 LIGHTTPD + MYSQL + PHP(FAST-CGI)
- Write CGI with Python (Lighttpd Server)
- 搭建web服务器之Apache服务器简单搭建过程记录
- OpenWrt搭建PPTP VPN服务器过程记录
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- 搭建一个轻量级服务器环境 LIGHTTPD + php
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- Lighttpd+Squid+Apache搭建高效率Web服务器
- 小论文之旅(2)——introduction与related work
- 年中总结
- RedisCluster搭建步骤
- Jsp空间上TOMCAT报 error listenerstart错误的解决办法
- Window属性
- lighttpd 服务器搭建过程记录2【with CGI】
- [326]Power of Three
- 约瑟夫环二
- Centos7下启用端口
- 【负载均衡】openstack负载均衡之haproxy
- MongoDB资料大全
- 自己工作的一点感想
- MAC unity 双开
- The most orz man(单堆NIM)