• 自动安装配置lighttpd小脚本
    时间:2008-11-14   作者:佚名   出处:互联网

    # Version 0.0.1.1 - P-DX44
    yum -y remove httpd
    yum -y install pcre-devel
    
    mkdir ~/src
    cd ~/src
    #下载安装包,自己修改相应的地址即可
    wget http://***/install/lighttpd-1.4.13.tar.gz
    
    tar xzvf lighttpd-1.4.13.tar.gz
    cd lighttpd-1.4.13
    ./configure --prefix=/is --with-openssl
    
    make && make install
    mkdir /var/www
    cd /var/www
    ln -sf /is/sbin/lighttpd Light
    mkdir log cache
    chown -R nobody:nobody log cache
    
    cat <<EOF > httpd.start
    PATH=$PATH:/var/www
    ulimit -c unlimited
    ulimit -n 8192
    
    cd /var/www
    exec Light -f www.conf
    EOF
    
    cat <<EOF > httpd.stop
    killall Light
    EOF
    
    chmod a+x httpd.start httpd.stop
    
    m4 -U format -D HOSTNAME=$(hostname) <<__EOF__ > www.conf
    server.port = 80
    server.event-handler = "linux-sysepoll"
    server.username = "nobody"
    server.groupname = "nobody"
    server.document-root = "/var/www/html"
    server.dir-listing = "disable"
    server.follow-symlink = "enable"
    server.indexfiles = ("index.html")
    server.max-keep-alive-requests = 0
    server.max-keep-alive-idle = 4
    server.errorlog="/var/www/log/lighttpd.error.log"
    server.max-fds = 40960
    server.modules          = ( "mod_rewrite",
                                "mod_redirect",
                                "mod_alias",
                                "mod_access",
                                "mod_auth",
                                "mod_status",
                                "mod_fastcgi",
                                "mod_proxy",
                                "mod_simple_vhost",
                                "mod_evhost",
    #                           "mod_userdir",
                                "mod_cgi",
                                "mod_compress",
    #                           "mod_usertrack",
                                "mod_expire",
                                "mod_secdownload",
                                "mod_flv_streaming",
    			    "mod_setenv",
                                "mod_accesslog" )
    
    setenv.add-response-header = ( "CPOINT" => "HOSTNAME" )
    
    flv-streaming.extensions = ( ".flv" )
    server.pid-file = "/var/www/log/httpd.pid"
    
    mimetype.assign = ( ".png"  => "image/png",
                        ".gif"  => "image/gif",
                        ".jpg"  => "image/jpeg",
                        ".jpeg" => "image/jpeg",
                        ".html" => "text/html",
                        ".txt"  => "text/plain",
                        ".wmv"  => "video/x-ms-wmv" )
    
    
    status.status-url = "/in-status"
    status.config-url = "/in-config"
    
    simple-vhost.server-root = "/var/www"
    simple-vhost.default-host = "default"
    simple-vhost.document-root = "html"
    
    compress.cache-dir = "/var/www/cache"
    compress.filetype = ("text/html", "text/plain")
    
    accesslog.filename = "/var/www/log/access.log"
    accesslog.format = "%h %l %u %t \"%m http://%v%U %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
    __EOF__
    
    mkdir -p default/html
    mkdir html
    

    ----------------------------------------------------------------------

    OK 安装配置成功,省心又省力!

    网友留言/评论

    我要留言/评论