Nginx教程

centos7 安装fastdfs 以及配置nginx模块

本文主要是介绍centos7 安装fastdfs 以及配置nginx模块,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

个人安装命令,描述慢慢加::

cd /usr/local/

git clone https://github.com/happyfish100/fastdfs.git

git clone https://github.com/happyfish100/libfastcommon.git

git clone https://github.com/happyfish100/fastdfs-nginx-module.git

cd libfastcommon/

./make.sh && ./make.sh install

cd fastdfs
./make.sh && ./make.sh install

cd /etc/fdfs/

cp /usr/local/fastdfs/conf/http.conf /etc/fdfs/

cp /usr/local/fastdfs/conf/mime.types /etc/fdfs/

cp usr/local/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/

mkdir -p /home/fdfs/tracker

mkdir -p /home/fdfs/storage

mkdir -p /home/fdfs/client

vim tracker.conf

base_path = /home/fdfs/tracker

http.server_port = 8080(不用修改需注意端口占用问题)

vim storage.conf

base_path = /home/fdfs/tracker

store_path0 = /home/fdfs/storage

tracker_server = {{ip}}:22122

http.server_port = 8888(对应nginx的端口配置)

vim client.conf

base_path = /home/fdfs/client

tracker_server = {{ip}}:22122

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start

/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start

 

ln -sv /usr/include/fastcommon /usr/local/include/fastcommon

ln -sv /usr/include/fastdfs /usr/local/include/fastdfs

ln -sv /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so

ln -s /usr/local/fastdfs/storage/data/ /usr/local/fastdfs/storage/data/M00

vim /usr/local/fastdfs-nginx-module/src/config

CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/local/include/fastcommon/”

cd /usr/local/nginx

./sbin/nginx -V

--prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module

cd nginx-1.18.0/

./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --add-module=/usr/local/fastdfs-nginx-module/src

make

cp objs/nginx /usr/local/nginx/sbin/nginx

cd /usr/local/nginx

vim conf/nginx.conf

server {
    listen 8888;
    server_name localhost;
    location ~/group[0-9]/ {
        ngx_fastdfs_module;
    }
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root html;
    }
}

./sbin/nginx -s reload

vim mod_fastdfs.conf

cd /etc/fdfs

vim mod_fastdfs.conf

base_path=/home/fdfs/tracker

tracker_server={{ip}}:22122

url_have_group_name = true

/usr/bin/fdfs_test /etc/fdfs/client.conf upload /usr/local/nginx/conf/nginx.conf

 

 example file url: http://39.104.128.96:8888/group1/M00/00/00/J2iAYGE17-aAEvFoAAAKcYwkqzI87_big.conf

在浏览器中能够成功下载

这篇关于centos7 安装fastdfs 以及配置nginx模块的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!