データ圧縮プロキシの立て方のメモ

  1. delegateImageMagick をインストール

  2. delegateユーザ(グループ名delegate)の作成

    ホームディレクトリは/home/delegateとしています。あと、/usr/bin/gzipがあることを前提にしてます。

  3. delegate用圧縮スクリプトを/home/delegate/lib/proxy.cfi におく

    内容は

    #!cfi
    Content-Type: image/jpeg
    Body-Filter: /usr/local/bin/convert -quality 15 +profile "*" -  jpeg:-
    --
    Content-Type: image/gif
    Body-Filter: /usr/local/bin/convert +adjoin - gif:- | /usr/local/bin/convert -colors 4 +dither -colorspace Transparent +profile "*" gif:- gif:-
    --
    Content-Type: image/png
    Body-Filter: /usr/local/bin/convert -colors 4 +dither -colorspace Transparent -quality 100 +profile "*" - png:-
    --
    Content-Type: image/bmp
    Body-Filter: /usr/local/bin/convert -colors 4 +dither -colorspace Transparent +profile "*" - bmp:-
    --
    Content-Type: application/x-shockwave-flash
    Body-Filter: /bin/cat /home/delegate/lib/flash.swf
    --
    Content-Type: application/x-shockwave-Flash
    Body-Filter: /bin/cat /home/delegate/lib/flash.swf
    --
    Content-Type: text/
    Output-Header: Content-Encoding: gzip
    Body-Filter: /usr/bin/gzip --best
    
  4. 置換用フラッシュファイルを/home/delegate/lib/flash.swfにおく

    できるだけ小さくしたフラッシュファイルはここにおいてあります。

  5. 以下のコマンドでdelegateを起動する

    AirH" Phoneセンター経由でしか繋がらないようになっています。

    /usr/local/sbin/delegated -P8080 \
        SERVER=http \
        ADMIN='ah@fo.gs' \
        OWNER='delegate/delegate' \
        LIBPATH='.:${STARTDIR}:${LIBDIR}:${EXECDIR}:/usr/bin' \
        RELIABLE='211.18.235.0/24' \
        RELIABLE='211.18.238.0/24' \
        RELIABLE='211.18.239.0/24' \
        RELIABLE='61.198.142.0/24' \
        RELIABLE='61.198.249.0/24' \
        RELIABLE='61.198.250.0/24' \
        RELIABLE='61.198.253.0/24' \
        RELIABLE='61.198.254.0/24' \
        RELIABLE='61.198.255.0/24' \
        RELIABLE='61.204.0.0/24' \
        RELIABLE='61.204.3.0/25' \
        RELIABLE='61.204.4.0/24' \
        RELIABLE='61.204.6.0/25' \
        RELIABLE='221.119.0.0/24' \
        RELIABLE='221.119.1.0/24' \
        RELIABLE='221.119.2.0/24' \
        RELIABLE='221.119.3.0/24' \
        RELIABLE='221.119.4.0/24' \
        RELIABLE='221.119.5.0/24' \
        RELIABLE='221.119.6.0/24' \
        RELIABLE='221.119.7.0/24' \
        RELIABLE='221.119.8.0/24' \
        RELIABLE='221.119.9.0/24' \
        RELIABLE='210.168.246.0/24' \
        RELIABLE='210.168.247.0/24' \
        RELAY=proxy \
        AUTH=viagen:- \
        AUTH=proxy:auth \
        AUTHORIZER=-delegate.users \
        TIMEOUT=restart:1800,standby:300 \
        FTOCL=proxy.cfi \
        LOGFILE= '' \
        PROTOLOG='${PORT}.${PROTO}[date+.%m-%d]' \
        ERRORLOG= '' \
        HTTPCONF=methods:* \
        HTTPCONF='add-qhead:X-Forwarded-For:%a' \
        HTTPCONF=cka-cfi \
        > /dev/null 2>&1
    
  6. delegate用ユーザの追加、削除

    ユーザの追加のコマンドは

    /usr/local/sbin/delegated OWNER=delegate/delegate -Fauth -a username:passwd -delegate.users
    

    ユーザの削除のコマンドは

    /usr/local/sbin/delegated OWNER=delegate/delegate -Fauth -d username -delegate.users
    

戻る