$ sudo apt update
$ sudo apt-get install build-essential
$ sudo apt install libtool
$ git clone https://github.com/happyfish100/libfastcommon.git
$ cd libfastcommon
$ ./make.sh clean && ./make.sh && sudo ./make.sh install
$ git clone https://github.com/happyfish100/fastdfs.git
$ cd fastdfs
$ ./make.sh clean && ./make.sh && sudo ./make.sh install
$ sudo ./setup.sh /etc/fdfs
$ sudo vi /etc/fdfs/tracker.conf
base_path=/home/fds/data # 目录的基路径
$ sudo vi /etc/fdfs/storage.conf
base_path=/home/fds/data # 目录的基路径
store_path0=/home/fds/data # 存储地址
tracker_server: 111.229.xx.xx:22122 # 本机地址
group_name=group1
$ sudo vi /etc/fdfs/client.conf
base_path=/home/fds/data # 目录的基路径
tracker_server: 111.229.xx.xx:22122 # 本机地址
$ sudo /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
$ sudo /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
$ sudo /usr/bin/fdfs_monitor /etc/fdfs/client.conf
$ /usr/bin/fdfs_upload_file /etc/fdfs/client.conf heying.jpg
返回:group1/M00/00/00/b-V5Xl6WzEmAEDBhAFdv5DZyXHk297.jpg
nginx : http://nginx.org/download/nginx-1.15.9.tar.gz
fastdfs-nginx-module: https://github.com/happyfish100/fastdfs-nginx-module
$ sudo apt-get install openssl libpcre3 libpcre3-dev zlib1g-dev
$ unzip fastdfs-nginx-module-master.zip
$ tar -zxvf nginx-1.15.9.tar.gz
$ cd nginx-1.15.9/
$ sudo ./configure --prefix=/usr/local/nginx/ --add-module=/home/fds/tmp/fastdfs-nginx-module-master/src
$ sudo make
$ sudo make install
$ sudo cp fastdfs-nginx-module-master/src/mod_fastdfs.conf /etc/fdfs/mod_fastdfs.conf
$ sudo vim /etc/fdfs/mod_fastdfs.conf
connect_timeout=10
tracker_server=111.229.xx.xx:22122
url_have_group_name=true
store_path0=/home/fds/data
$ sudo vim /usr/local/nginx/conf/nginx.conf
server {
listen 8888;
server_name localhost;
location ~/group[0-9]/ {
ngx_fastdfs_module;
}
location / {
root html;
index index.html index.htm;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
$ sudo /usr/local/nginx/sbin/nginx
http://111.229.xx.xx:8888/group1/M00/00/00/b-V5Xl6W0GWAXtTMAFdv5DZyXHk275.jpg