Configure Nginx to implement fastdFS file server

1. Install the nginx-Fastdfs module

PS: Ensure that the path of the Nginx server is the same as that of the storage node

Operation Storage Server Server node

  • The tar - ZXVF fastdfs - nginx - module - 1.22. Tar. GzDecompress the uploaded nginx-Fastdfs module package
  • CD/home/software/fastdfs - nginx - module - 1.22 / SRC
  • vim config

  • cp mod_fastdfs.conf /etc/fdfs/Copy the linked configuration file

2. Install nginx

  • yum install -y pcre pcre-devel
  • yum install -y zlib zlib-devel
  • yum install -y openssl openssl-devel
  • The tar - ZXVF nginx - 1.16.1. Tar. Gz
  • mkdir /var/temp/nginx -p
  • CD/home/software/nginx - 1.16.1
  • `./configure \

–prefix=/usr/local/nginx –pid-path=/var/run/nginx/nginx.pid –lock-path=/var/lock/nginx.lock –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –with-http_gzip_static_module –http-client-body-temp-path=/var/temp/nginx/client –http-proxy-temp-path=/var/temp/nginx/proxy –http-fastcgi-temp-path=/var/temp/nginx/fastcgi –http-uwsgi-temp-path=/var/temp/nginx/uwsgi – HTTP – scgi – temp – path = / var/temp/nginx/scgi – add – the module = / home/software/fastdfs – nginx – module – 1.22 / SRC `

  • make
  • make install

Configure the nginx-Fastdfs module configuration file

  • cd /etc/fdfs/
  • vim mod_fastdfs.conf

  • mkdir /usr/local/fastdfs/tmp
  • cd /usr/local/nginx/conf/
  • vim nginx.conf

PS: The listen port is the same as http.server_port in storage.conf

server { listen 8888; server_name localhost; location /beyond/M00 { ngx_fastdfs_module; }}Copy the code

  • ../sbin/nginx -tCheck the Nginx configuration
  • ../sbin/nginxStart the nginx

3. The test

  • The last image saved in the previous section is named:wKhcmGDbPF-ASdoRAAAVWK-BYbY482.jpg

  • Browser access to our Srorage Server node:http://192.168.92.152:8888/beyond/M00/00/00/20210328103402865.jpg

Download: