ngx-fastdfs:nginx + lua + fastdfs 实现分布式图片实时动态压缩
lahu9554
8年前
<h3>install</h3> <pre> <code class="language-lua">进入docker目录 docker build -t fastdfs:dev .</code></pre> <h3>使用</h3> <pre> <code class="language-lua">docker -idt -p 80:80 fastdfs:dev /bin/bash 进入容器执行 /etc/rc.local</code></pre> <h3>测试</h3> <pre> <code class="language-lua">进入容器执行test目录下的./test.sh或者直接执行下面脚本 fdfs_test /etc/fdfs/client.conf upload /home/steven/01.jpg ... group_name=group1, ip_addr=192.168.1.181, port=23000 storage_upload_by_filename group_name=group1, remote_filename=M00/00/00/wKgdhFTV0ZmAP3AZAPk-Io7D4w8580.jpg ... example file url: http://192.168.1.181/group1/M00/00/00/wKgdhFTV0ZmAP3AZAPk-Io7D4w8580.jpg storage_upload_slave_by_filename group_name=group1, remote_filename=M00/00/00/wKgdhFTV0ZmAP3AZAPk-Io7D4w8580_big.jpg ... example file url: http://192.168.1.181/group1/M00/00/00/wKgdhFTV0ZmAP3AZAPk-Io7D4w8580_big.jpg</code></pre> <h3>php调用</h3> <pre> <code class="language-lua">首先进入php_client ./configure --with-php-config=/usr/local/php/bin/php-config make&&make install 在php.ini里添加 extension=fastdfs_client.so [fastdfs_client] fastdfs_client.base_path = /home/fastdfs/fastdfs fastdfs_client.connect_timeout = 2 fastdfs_client.network_timeout = 60 fastdfs_client.log_level = info fastdfs_client.log_filename = fastdfs_client.tracker_group_count = 1 fastdfs_client.tracker_group0 = /etc/fdfs/client.conf fastdfs_client.use_connection_pool = true fastdfs_client.connection_pool_max_idle_time = 3600 根据自己的情况做相应的修改 重启php-fpm 执行test目录下的fastdfs.php就可以看到效果了</code></pre> <h3>使用效果</h3> <p style="text-align:center"><img src="https://simg.open-open.com/show/0c113d3aa6346ead4906cdf12ed448d6.png"></p> <h3> </h3> <p> </p>