• ADADADADAD

    zimg安装[ mysql数据库 ]

    mysql数据库 时间:2024-12-03 12:12:33

    作者:文/会员上传

    简介:

    准备环境1.1、安转必备软件There are several dependences of zimg youshould build and install before using zimg. And the version of cmake should>= 2.8, libevent sh

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    准备环境1.1、安转必备软件

    There are several dependences of zimg youshould build and install before using zimg. And the version of cmake should>= 2.8, libevent should >= 2.0, libmemcached should >= 1.0.18.

    yum installopenssl-devel cmake libevent-devel libjpeg-devel giflib-devel libpng-devellibwebp-devel ImageMagick-devel libmemcached-devel

    安装需要的软件,但是libwebp-devel yum上没有

    libwebp-devel、libevent和libmemcached需要重新编译,因为yum 上的版本过低

    1、安装libevent

    wgethttp://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz

    tarzxvflibevent-2.0.17-stable.tar.gz

    cdlibevent-2.0.17-stable

    ./configure--prefix=/usr/local

    make&& make install

    2、安装libmemcached

    wgethttps://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

    tarzxvf libmemcached-1.0.18.tar.gz

    cdlibmemcached-1.0.18

    ./configure-prefix=/usr/local

    make && make install

    3、安装libwebp-devel

    wgethttp://downloads.webmproject.org/releases/webp/libwebp-0.4.1.tar.gz(此文件暂时下载不下来 )

    tarzxvflibwebp-0.4.1.tar.gz

    cdlibwebp-0.4.1

    ./configure

    make

    sudo make install

    、安装

    Now you can build zimg itself. If you wantto gdbzimg, you can use makedebug option.

    git clone https://github.com/buaazp/zimg -bmaster --depth=1

    cdzimg

    make

    If you want to enable cache to improveperformance, or you want to store the images to a distributed storage backend,the softwares below is optional.

    Build OptionalStorage Backendsmemcached ( optional)

    wgethttp://www.memcached.org/files/memcached-1.4.19.tar.gz

    tarzxvfmemcached-1.4.19.tar.gz

    cdmemcached-1.4.19

    ./configure--prefix=/usr/local

    make

    make install

    beansdb ( optional )

    git clonehttps://github.com/douban/beansdb

    cdbeansdb

    ./configure--prefix=/usr/local

    make

    benseye ( optional )

    git clonegit@github.com:douban/beanseye.git

    cdbeanseye

    make

    SSDB ( optional )

    wget--no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip

    unzip master

    cdssdb-master

    make

    twemproxy ( optional)

    git clonegit@github.com:twitter/twemproxy.git

    cdtwemproxy

    autoreconf-fvi

    ./configure--enable-debug=log

    make

    src/nutcracker -h

    三、启动运行

    在运行zimg之前,你需要按照《Install文档》的说明进行安装,zimg安装成功之后,即可简单修改配置文件后启动。zimg本身的所有选项都在配置文件中进行配置,你可以根据自己的需要修改配置文件:

    --zimg serverconfig

    --serverconfig

    --是否后台运行

    is_daemon = 1

    --绑定IP

    ip = '0.0.0.0'

    --端口

    port = 4869

    --运行线程数,默认值为服务器CPU数

    --thread_num=4

    backlog_num = 1024

    max_keepalives = 1

    retry = 3

    system = io.popen('uname -sn'):read('*l')

    pwd = io.popen('pwd'):read('*l')

    --headerconfig

    --返回时所带的HTTP header

    headers = 'Cache-Control:max-age=7776000'

    --是否启用etag缓存

    etag = 1

    --access config

    --supportmask rules like 'allow 10.1.121.138/24'

    --NOTE:remove rule can improve performance

    --上传接口的IP控制权限,将权限规则注释掉可以提升服务器处理能力,下同

    --upload_rule = 'allow all'

    --下载接口的IP控制权限

    --download_rule= 'allow all'

    --管理接口的IP控制权限

    admin_rule = 'allow 127.0.0.1'

    --cacheconfig

    --是否启用memcached缓存

    cache = 1

    --缓存服务器IP

    mc_ip = '127.0.0.1'

    --缓存服务器端口

    mc_port = 11211

    --log config

    --log_leveloutput specified level of log to logfile

    --[[

    LOG_FATAL0 System is unusable

    LOG_ALERT1 Action must be taken immediately

    LOG_CRIT2 Critical conditions

    LOG_ERROR3 Error conditions

    LOG_WARNING4 Warning conditions

    LOG_NOTICE5 Normal, but significant

    LOG_INFO6 Information

    LOG_DEBUG7 DEBUG message

    ]]

    --输出log级别

    log_level = 6

    --输出log路径

    log_name = pwd .. '/log/zimg.log'

    --htdocconfig

    --默认主页html文件路径

    root_path = pwd .. '/www/index.html'

    --admin页面html文件路径

    admin_path = pwd .. '/www/admin.html'

    --imageprocess config

    --禁用URL图片处理

    disable_args = 0

    --禁用lua脚本图片处理

    disable_type = 0

    --lua processscript

    --lua脚本文件路径

    script_name = pwd .. '/script/process.lua'

    --formatvalue: 'none' for original or other format names

    --默认保存新图的格式,字符串'none'表示以原有格式保存,或者是期望使用的格式名

    format = 'jpeg'

    --qualityvalue: 1~100(default: 75)

    --默认保存新图的质量

    quality = 75

    --storageconfig

    --zimgsupport 3 ways for storage images

    --存储后端类型,1为本地存储,2为memcached协议后端如beansdb,3为redis协议后端如SSDB

    mode = 1

    --save_newvalue: 0.don't save any 1.save all 2.only save types in lua script

    --新文件是否存储,0为不存储,1为全都存储,2为只存储lua脚本产生的新图

    save_new = 1

    --上传图片大小限制,默认100MB

    max_size = 100*1024*1024

    --允许上传图片类型列表

    allowed_type = {'jpeg', 'jpg', 'png', 'gif', 'webp'}

    --mode[1]:local disk mode

    --本地存储时的存储路径

    img_path = pwd .. '/img'

    --mode[2]:beansdb mode

    --beansdb服务器IP

    beansdb_ip = '127.0.0.1'

    --beansdb服务器端口

    beansdb_port = 7900

    --mode[3]:ssdb mode

    --SSDB服务器IP

    ssdb_ip = '127.0.0.1'

    --SSDB服务器端口

    ssdb_port = 8888

    四、安装结构验证

    然后启动zimg:

    cd bin

    ./zimgconf/zimg.lua

    使用上传

    zimg启动之后就可以开始上传和下载图片了,上传方式有两种:

    第一种是通过浏览器上传,启动zimg后的默认地址就是一个简单的图片上传页:

    http://127.0.0.1:4869/

    大约是这个样子的:

    上传成功之后会以HTML的格式返回该图片的MD5:

    五、其他常用命令

    使用到的命令

    http://zimg.buaa.us/documents/guidebookcn/
    zimg安装.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: zimg安装zi