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
  • 相关阅读:
    Server Apache Tomcat v7.0 at localhost failed to start.
    iOS-UITextField、一些知识点
    iOS-UIButton
    iOS-URL
    iOS-UITableView(三)
    iOS-MVC(转)
    iOS-UITableView(二)
    iOS-UITableView(一)
    iOS-UIScrollView以及代理
    iOS-UIView常见方法、xib的基本使用
  • 原文地址:https://www.cnblogs.com/chengliu/p/3636372.html
Copyright © 2011-2022 走看看