安装FastDFS图片服务器

1.安装FastDFS

安装网址:

CentOS7 64位虚拟机安装FastDFS完整步骤_顶尖高中生的博客-CSDN博客

2.Java代码测试FastDFS文件上传

安装FastDFS图片服务器_第1张图片

相关依赖:

 
    net.oschina.zcx7878 
    fastdfs-client-java 
    1.27.0.0 

fastdfs.conf:

connect_timeout=2
network_timeout=30
charSet=UTF-8
http.tracker_http_port=8080
http.anti_steal_token=no
http.secret_key=FastDFS1234567890
tracker_server=192.168.239.133:22122

App:

​public class App { 
    public static void main( String[] args ) throws Exception {                         
        ClientGlobal.init("fastdfs.conf"); TrackerClient tc = new TrackerClient(); 
        TrackerServer server = tc.getConnection(); 
        StorageServer stserver = null; 
        StorageClient stclient = new StorageClient(server, stserver); 
        String[] jpgs = stclient.upload_file("d:/img/a.jpg", "jpg", null); 
        for (String jp:jpgs) { 
            System.out.println(jp); 
        }
        System.out.println("upload finish!"); 
    } 
}

3.安装Nginx

安装网址:

CentOS7 64位虚拟机安装Nignx完整步骤_顶尖高中生的博客-CSDN博客

4.最后浏览器访问地址,查看效果

http://192.168.42.200/group1/M00/00/00/wKgqyGDV6myAPxf6AAIe3sfG-s8622.jpg

你可能感兴趣的:(FastDFS,nginx)