Nginx 整合FastDFS

  • 安裝nginx

https://blog.csdn.net/mengxianglong123/article/details/103193921

  • 安裝fastdfs

https://blog.csdn.net/mengxianglong123/article/details/103175807

  • 安裝fastdfs-nginx-module
git clone https://github.com/happyfish100/fastdfs-nginx-module.git --depth 1
cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs # 複製配置文件
  • 更改nginx配置
#在nginx解壓後的文件夾中執行添加fastdfs-nginx-module模塊
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ 
make && make install #重新編譯安裝
  • 配置nginx訪問
vim /etc/fdfs/mod_fastdfs.conf
#需要修改的內容如下
tracker_server=192.168.52.1:22122  #tracker服務器IP和端口
url_have_group_name=true
store_path0=/home/dfs
#配置nginx.config
vim /usr/local/nginx/conf/nginx.conf
#添加如下配置
server {
    listen       8888;    ## 該端口爲storage.conf中的http.server_port相同
    server_name  localhost;
    location ~/group[0-9]/ {
        ngx_fastdfs_module;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   html;
    }
}

啓動nginx,通過返回的id即可訪問文件

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章