yum install gcc-c++
yum install -y pcre pcre-devel
**yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
wget http://nginx.org/download/nginx-1.12.0.tar.gz
tar -zxvf nginx-1.12.0.tar.gz
./configure
make && make install
cd /usr/local/nginx
,存在conf、sbin、html文件夹,安装成功!
/usr/local/nginx/sbin/nginx
,使用虚拟机ip进行访问。
cd /usr/local/nginx/sbin && ./nginx -s quit
(推荐)
cd /usr/local/nginx/sbin && ./nginx -s quit && ./nginx
(推荐)cd /usr/local/nginx/sbin && ./nginx -s reload
yum install gcc-c++
yum -y install libevent
cd /usr/local && tar -zxvf libfastcommon-1.0.43.tar.gz && cd libfastcommon-1.0.43 && ./make.sh && ./make.sh install
cd /usr/local/ && tar -zxvf fastdfs-6.06.tar.gz && cd fastdfs-6.06/ && ./make.sh && ./make.sh install
cd conf/ && cp ./* /etc/fdfs/
配置
cd /etc/fdfs/ && vim tracker.conf
启动
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
环境、库、安装包
配置
cd /etc/fdfs/ && vim storage.conf
启动
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
fastdfs-nginx-module_url:
cd /usr/local && tar -zxvf fastdfs-nginx-module-1.22.tar.gz && cd fastdfs-nginx-module-1.22
cp /usr/local/fastdfs-nginx-module-1.22/src/mod_fastdfs.conf /etc/fdfs/
vim /etc/fdfs/mod_fastdfs.conf
前往nginx安装目录并执行:
cd /home/dj/dev/nginx/nginx-1.12.0/ && ./configure --add-module=/usr/local/fastdfs-nginx-module-1.22/src && make && make install
vim /usr/local/nginx/conf/nginx.conf
location ~/group([0-9]) { ngx_fastdfs_module; }
<dependency> <groupId>net.oschina.zcx7878</groupId> <artifactId>fastdfs-client-java</artifactId> <version>1.27.0.0</version> </dependency>
fastdfs.connect_timeout_in_seconds = 5 fastdfs.network_timeout_in_seconds = 30 fastdfs.charset = UTF-8 fastdfs.http_anti_steal_token = false fastdfs.http_secret_key = FastDFS1234567890 fastdfs.http_tracker_http_port = 80 fastdfs.tracker_servers = 192.168.1.11:22122 fastdfs.connection_pool.enabled = true fastdfs.connection_pool.max_count_per_entry = 500 fastdfs.connection_pool.max_idle_time = 3600 fastdfs.connection_pool.max_wait_time_in_ms = 1000
package top.dj; import lombok.extern.slf4j.Slf4j; import org.csource.common.NameValuePair; import org.csource.fastdfs.*; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; /** * @Author: DengJia * @Date: 2021/9/7 21:49 * @Description: */ @SpringBootTest @Slf4j public class DFSTest { private final static Logger logger = LoggerFactory.getLogger(DFSTest.class); @Test void testUpload() { try { ClientGlobal.initByProperties("fastdfs-client.properties"); TrackerClient tracker = new TrackerClient(); TrackerServer trackerServer = tracker.getConnection(); StorageServer storageServer = null; StorageClient1 client = new StorageClient1(trackerServer, storageServer); NameValuePair nvp[] = null; //上传到文件系统 String fileId = client.upload_file1("F:\\ps\\centos-docker.png", "png", nvp); logger.info(fileId); } catch (Exception e) { e.printStackTrace(); } } }