zoukankan      html  css  js  c++  java
  • ubuntu下安装lighttpd

    Lighttpd

    sudo apt-get install lighttpd   #安装lighttpd

    安装后系统会自动启动lighttpd,打开http://localhost 便是,如果你之前有装Apache,那默认主页换成 http://localhost/index.lighttpd.html

    web服务器的根目录是在 /var/www/ ,图片目录是:/usr/share/images/,配置文件是在/etc/lighttpd/lighttpd.conf。

    重启lighttpd的命令

    sudo /etc/init.d/lighttpd restart 
    Lighttpd默认页面

    启用用户目录

    启用用户目录后,每个用户的home目录便有自个的web目录。命令:

    sudo lighttpd-enable-mod userdir

    重新载入配置

    sudo service lighttpd reload

    现在用户可以放置文件到home目录下的public_html文件夹内。比如qii用户需要放置文件到/home/joe/public_html,打开 http://loaclhost/~qii


    Hello world example

    Save this "Hello world !" source code example in /var/www/cgi-bin (create this directory if it not exists).

    #include "stdio.h"
     
    int main(void) {
      printf( "Content-Type: text/plain
    
    " );
      printf("Hello world !
    ");
      return 0;
    }

    Compile it typing:

    debarm:~# gcc hello.c -o hello.cgi
    

    lighttpd configuration

    Change the server.modules list inside /etc/lighttpd/lighttpd.conf in:

    server.modules              = (
                "mod_access",
                "mod_cgi",
                "mod_alias",
                "mod_accesslog",
                "mod_compress",
    )
    

    and add these lines:

    $HTTP["url"] =~ "/cgi-bin/" {
            cgi.assign = ( "" => "" )
    }
    
    cgi.assign      = (
            ".cgi"  => ""
    )
    

    Restart lighttpd typing:

    debarm:~# /etc/init.d/lighttpd restart
    

    Final test

    Access with your browser to the FOX Board web page using this URL:

    http:///cgi-bin/hello.cgi
    



    参考文章:http://wiki.ubuntu.org.cn/Lighttpd
    http://www.acmesystems.it/foxg20_cgi
  • 相关阅读:
    opencv源码编译安装后使用时出现undefined reference cv::imwrite
    OPPO手机永久打开USB调试模式
    bash 顺序执行等待前一个脚本执行完成
    cpp
    多线程
    关于nvme下ubuntu无法识别硬盘的问题
    极限建站
    新生赛
    pc_mbed_fpga_communication
    color_sensor_mbed
  • 原文地址:https://www.cnblogs.com/chengliu/p/3636372.html
Copyright © 2011-2022 走看看