{"id":477,"date":"2010-01-14T17:31:50","date_gmt":"2010-01-14T10:31:50","guid":{"rendered":"http:\/\/www.icez.net\/blog\/?p=477"},"modified":"2010-02-15T23:23:59","modified_gmt":"2010-02-15T16:23:59","slug":"lusca-cdn-installation","status":"publish","type":"post","link":"https:\/\/www.icez.net\/blog\/477\/lusca-cdn-installation","title":{"rendered":"0088 | LUSCA CDN installation"},"content":{"rendered":"<p>\u0e08\u0e14\u0e44\u0e27\u0e49\u0e01\u0e31\u0e19\u0e25\u0e37\u0e21\u0e04\u0e23\u0e31\u0e1a \u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e43\u0e2a\u0e48\u0e43\u0e08\u0e21\u0e32\u0e01\u0e21\u0e32\u0e22<\/p>\n<p><a href=\"http:\/\/code.google.com\/p\/lusca-cache\/downloads\/list\">http:\/\/code.google.com\/p\/lusca-cache\/downloads\/list<\/a><\/p>\n<pre lang=\"bash\">.\/configure --prefix=\/usr\/local\/lusca --with-maxfd=32768 --with-aio --with-pthreads --disable-ident-lookups --enable-snmp --enable-storeio=\"aufs\" --enable-removal-policies=\"heap lru\" --disable-wccp && make && make install\r\nln -s \/usr\/local\/lusca\/etc \/etc\/lusca\r\nln -s \/usr\/local\/lusca\/var\/logs \/var\/log\/lusca\r\nmkdir \/usr\/local\/lusca\/var\/cache\r\nchown nobody \/usr\/local\/lusca\/var\/cache \/usr\/local\/lusca\/var\/logs\r\nln -s \/usr\/local\/lusca\/sbin\/squid \/usr\/sbin\/squid\r\nln -s \/usr\/local\/lusca\/bin\/squidclient \/usr\/bin\/squidclient\r\n<\/pre>\n<p>cron<\/p>\n<pre lang=\"cron\">4 * * * * \/usr\/sbin\/squid -k rotate<\/pre>\n<p>config<\/p>\n<pre lang=\"apache\">acl all src all\r\nacl manager proto cache_object\r\nacl localhost src 127.0.0.1\/32\r\nacl CONNECT method CONNECT\r\nhttp_access allow manager localhost\r\nhttp_access deny manager\r\nhttp_access deny CONNECT\r\nacl upic_host dst 124.109.2.175 124.109.2.176\r\nacl upic_port port 80\r\nhttp_access allow upic_host upic_port\r\nhttp_access deny all\r\nicp_access deny all\r\nhttp_port 80 accel vhost\r\ncache_peer 124.109.2.176 parent 80 0 weight=5 no-query round-robin\r\ncache_peer 124.109.2.175 parent 80 0 weight=5 no-query round-robin\r\ncache_mem 32 MB\r\nmaximum_object_size_in_memory 16 KB\r\nmemory_replacement_policy heap GDSF\r\ncache_replacement_policy heap LFUDA\r\ncache_dir aufs \/usr\/local\/lusca\/var\/cache 8192 16 256\r\nlogformat combined %>a %ui %un [%tl] \"%rm %ru HTTP\/%rv\" %Hs %<st \"%{Referer}>h\" \"%{User-Agent}>h\" %Ss:%Sh\r\naccess_log \/usr\/local\/lusca\/var\/logs\/access.log combined\r\ncache_store_log none\r\nlogfile_rotate 24\r\nrefresh_pattern ^ftp:           1440    20%     10080\r\nrefresh_pattern ^gopher:        1440    0%      1440\r\nrefresh_pattern -i (\/cgi-bin\/|\\?) 0     0%      0\r\nrefresh_pattern .               0       20%     4320\r\nacl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]\r\nupgrade_http0.9 deny shoutcast\r\nacl apache rep_header Server ^Apache\r\nbroken_vary_encoding allow apache\r\ncache_effective_user nobody\r\nserver_persistent_connections off\r\nacl nullreferer referer_regex ^$\r\ncache deny nullreferer\r\nvisible_hostname cdn.upic.me\r\nsnmp_port 3401\r\nacl snmppublic snmp_community public\r\nsnmp_access allow snmppublic localhost\r\nsnmp_access deny all\r\nnever_direct allow all\r\ncoredump_dir \/usr\/local\/lusca\/var\/cache\r\npid_filename \/var\/run\/lusca.pid<\/pre>\n<p>\/etc\/init.d\/lusca<\/p>\n<pre lang=\"bash\">#!\/bin\/bash\r\n# squid         This shell script takes care of starting and stopping\r\n#               Squid Internet Object Cache\r\n#\r\n# chkconfig: - 90 25\r\n# description: Squid - Internet Object Cache. Internet object caching is \\\r\n#       a way to store requested Internet objects (i.e., data available \\\r\n#       via the HTTP, FTP, and gopher protocols) on a system closer to the \\\r\n#       requesting site than to the source. Web browsers can then use the \\\r\n#       local Squid cache as a proxy HTTP server, reducing access time as \\\r\n#       well as bandwidth consumption.\r\n# pidfile: \/var\/run\/squid.pid\r\n# config: \/etc\/squid\/squid.conf\r\n\r\nPATH=\/usr\/bin:\/sbin:\/bin:\/usr\/sbin\r\nexport PATH\r\n\r\n# Source function library.\r\n. \/etc\/rc.d\/init.d\/functions\r\n\r\n# Source networking configuration.\r\n. \/etc\/sysconfig\/network\r\n\r\n# don't raise an error if the config file is incomplete\r\n# set defaults instead:\r\nSQUID_OPTS=${SQUID_OPTS:-\"-D\"}\r\nSQUID_PIDFILE_TIMEOUT=${SQUID_PIDFILE_TIMEOUT:-20}\r\nSQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100}\r\n\r\n# determine the name of the squid binary\r\n[ -f \/usr\/sbin\/squid ] && SQUID=squid\r\n\r\nprog=\"$SQUID\"\r\n\r\n# determine which one is the cache_swap directory\r\nCACHE_SWAP=`sed -e 's\/#.*\/\/g' \/etc\/lusca\/squid.conf | \\\r\n        grep cache_dir |  awk '{ print $3 }'`\r\n[ -z \"$CACHE_SWAP\" ] && CACHE_SWAP=\/usr\/local\/lusca\/var\/cache\/\r\n\r\nRETVAL=0\r\n\r\nstart() {\r\n        ulimit -HSn 32768\r\n        #check if the squid conf file is present\r\n        if [ ! -f \/etc\/lusca\/squid.conf ]; then\r\n            echo \"Configuration file \/etc\/lusca\/squid.conf missing\" 1>&2\r\n            exit 6\r\n        fi\r\n\r\n        # don't raise an error if the config file is incomplete.\r\n        # set defaults instead:\r\n        SQUID_OPTS=${SQUID_OPTS:-\"-D\"}\r\n        SQUID_PIDFILE_TIMEOUT=${SQUID_PIDFILE_TIMEOUT:-20}\r\n        SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100}\r\n\r\n        if [ -z \"$SQUID\" ]; then\r\n                echo \"Insufficient privilege\" 1>&2\r\n                exit 4\r\n        fi\r\n\r\n        for adir in $CACHE_SWAP; do\r\n        if [ ! -d $adir\/00 ]; then\r\n             echo -n \"init_cache_dir $adir... \"\r\n             $SQUID -z -F -D >> \/var\/log\/lusca\/squid.out 2>&1\r\n        fi\r\n    done\r\n    echo -n $\"Starting $prog: \"\r\n    $SQUID $SQUID_OPTS >> \/var\/log\/lusca\/squid.out 2>&1\r\n    RETVAL=$?\r\n    if [ $RETVAL -eq 0 ]; then\r\n       timeout=0;\r\n       while : ; do\r\n          [ ! -f \/var\/run\/lusca.pid ] || break\r\n          if [ $timeout -ge $SQUID_PIDFILE_TIMEOUT ]; then\r\n             RETVAL=1\r\n             break\r\n          fi\r\n          sleep 1 && echo -n \".\"\r\n          timeout=$((timeout+1))\r\n       done\r\n    fi\r\n    [ $RETVAL -eq 0 ] && touch \/var\/lock\/subsys\/$SQUID\r\n    [ $RETVAL -eq 0 ] && echo_success\r\n    [ $RETVAL -ne 0 ] && echo_failure\r\n    echo\r\n    return $RETVAL\r\n}\r\n\r\nstop() {\r\n\r\n    # don't raise an error if the config file is incomplete.\r\n    # set defaults instead:\r\n    SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100}\r\n\r\n    echo -n  $\"Stopping $prog: \"\r\n    $SQUID -k check >> \/var\/log\/lusca\/squid.out 2>&1\r\n    RETVAL=$?\r\n    if [ $RETVAL -eq 0 ] ; then\r\n        $SQUID -k shutdown &\r\n        rm -f \/var\/lock\/subsys\/$SQUID\r\n        timeout=0\r\n        while : ; do\r\n                [ -f \/var\/run\/lusca.pid ] || break\r\n                if [ $timeout -ge $SQUID_SHUTDOWN_TIMEOUT ]; then\r\n                    echo\r\n                    return 1\r\n                fi\r\n                sleep 2 && echo -n \".\"\r\n                timeout=$((timeout+2))\r\n        done\r\n        echo_success\r\n        echo\r\n    else\r\n        echo_failure\r\n        echo\r\n    fi\r\n    return $RETVAL\r\n}\r\n\r\nreload() {\r\n#    . \/etc\/sysconfig\/squid\r\n    # don't raise an error if the config file is incomplete.\r\n    # set defaults instead:\r\n    SQUID_OPTS=${SQUID_OPTS:-\"-D\"}\r\n\r\n    $SQUID $SQUID_OPTS -k reconfigure\r\n}\r\n\r\nrestart() {\r\n    stop\r\n    start\r\n}\r\n\r\ncondrestart() {\r\n    [ -e \/var\/lock\/subsys\/squid ] && restart || :\r\n}\r\n\r\nrhstatus() {\r\n    status $SQUID && $SQUID -k check\r\n}\r\n\r\nprobe() {\r\n    return 0\r\n}\r\n\r\ncase \"$1\" in\r\nstart)\r\n    start\r\n    ;;\r\n\r\nstop)\r\n    stop\r\n    ;;\r\n\r\nreload)\r\n    reload\r\n    ;;\r\n\r\nrestart)\r\n    restart\r\n    ;;\r\n\r\ncondrestart)\r\n    condrestart\r\n    ;;\r\n\r\nstatus)\r\n    rhstatus\r\n    ;;\r\n\r\nprobe)\r\n    exit 0\r\n    ;;\r\n\r\n*)\r\n    echo $\"Usage: $0 {start|stop|status|reload|restart|condrestart}\"\r\n    exit 2\r\nesac\r\n\r\nexit $?\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0e08\u0e14\u0e44\u0e27\u0e49\u0e01\u0e31\u0e19\u0e25\u0e37\u0e21\u0e04\u0e23\u0e31\u0e1a \u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e43\u0e2a\u0e48\u0e43\u0e08\u0e21\u0e32\u0e01\u0e21\u0e32\u0e22 http:\/\/code.google.com\/p\/lusca-cache\/downloads\/list .\/configure &#8211;prefix=\/usr\/local\/lusca &#8211;with-maxfd=32768 &#8211;with-aio &#8211;with-pthreads &#8211;disable-ident-lookups &#8211;enable-snmp &#8211;enable-storeio=&#8221;aufs&#8221; &#8211;enable-removal-policies=&#8221;heap lru&#8221; &#8211;disable-wccp &#038;&#038; make &#038;&#038; make install ln -s \/usr\/local\/lusca\/etc \/etc\/lusca ln -s \/usr\/local\/lusca\/var\/logs \/var\/log\/lusca mkdir \/usr\/local\/lusca\/var\/cache chown nobody \/usr\/local\/lusca\/var\/cache \/usr\/local\/lusca\/var\/logs ln -s \/usr\/local\/lusca\/sbin\/squid \/usr\/sbin\/squid ln -s \/usr\/local\/lusca\/bin\/squidclient \/usr\/bin\/squidclient cron 4 * * * * \/usr\/sbin\/squid -k rotate config acl all src all [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,48,114],"class_list":["post-477","post","type-post","status-publish","format-standard","hentry","category-misc","tag-cdn","tag-install","tag-lusca"],"_links":{"self":[{"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/posts\/477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/comments?post=477"}],"version-history":[{"count":7,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/posts\/477\/revisions"}],"predecessor-version":[{"id":538,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/posts\/477\/revisions\/538"}],"wp:attachment":[{"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/media?parent=477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/categories?post=477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/tags?post=477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}