Installing fastdfs under nginx

1. Install gcc environment

yum install gcc-c++

2. Install two libraries
The first libevent Library

yum -y install libevent

The second libfastcommon Library
libfastcommon download address: https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz

Copy the downloaded libfastcommon to the / usr/local / directory, and then execute the following commands in sequence:

cd /usr/local
tar -zxvf V1.0.43.tar.gz
cd libfastcommon-1.0.43/
./make.sh
./make.sh install

3. Download an installation package
Next, let's download Tracker. Note that since Tracker and Storage are the same installation package, you can download it once
Download address
https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz
After the download is successful, copy the downloaded files to the / usr/local directory, and then execute the following commands to install:

cd /usr/local
tar -zxvf V6.06.tar.gz
cd fastdfs-6.06/
./make.sh
./make.sh install

After successful installation, execute the following command to copy the configuration file under the conf directory in the installation directory to the / etc/fdfs Directory:

cd conf/
cp ./* /etc/fdfs/

4. Configuration
Next, enter the / etc/fdfs / directory for configuration:

Open tracker Conf file:
vi tracker.conf
port and base_ Change the path to your own
5. Start

Next, execute the following command to start the Tracker:

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

2.2 Storage installation
Enter the / etc/fdfs directory and configure Storage:

vi storage.conf

Modify base_path ,store_path0 ,tracker_server
After configuration, execute the following command to start Storage:

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

2.3 Nginx installation

1. Installation package

wget http://nginx.org/download/nginx-1.17.0.tar.gz

2. Decompression

tar zxvf nginx-1.17.0.tar.gz

3. Enter the directory

cd nginx-1.17.0

4. Install two environments

yum -y install pcre-devel
yum -y install openssl openssl-devel

5. Then start compiling and installing:

./configure

make

make install

6. After installation, the default installation position is:

/usr/local/nginx/sbin/nginx

7. Enter the sbin directory of this directory and execute nginx to start nginx:

/usr/local/nginx/sbin/nginx

8. If the Nginx configuration is modified, you can reload the Nginx configuration file through the following command:

./nginx -s reload

2.4 fastdfs nginx module installation
1. First download fastdfs nginx module,
Download address: https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz
2. After downloading, copy the downloaded file to / usr/local directory. Then enter the / usr/local directory and execute the following commands respectively

cd /usr/local
tar -zxvf V1.22.tar.gz

3. Then add / usr / local / fastdfs nginx module-1.22/src/mod_ fastdfs. Copy the conf file to / etc/fdfs / directory and modify the contents of the file:

vi /etc/fdfs/mod_fastdfs.conf

4. Next, go back to the unzipped directory of the nginx installation file downloaded in the first step, execute the following command to reconfigure the compilation and installation:

./configure --add-module=/usr/local/fastdfs-nginx-module-1.22/src
make
make install

5. Modify the configuration file

vi /usr/local/nginx/conf/nginx.conf
    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        #Just configure this
         location ~/group([0-9]){
	     ngx_fastdfs_module;
			}
			
    	Other contents.....			

Configure nginx request forwarding here.
After the configuration is completed, start nginx and see the following log, indicating that nginx is started successfully:

ngx_http_fastdfs_set pid=xxx

Keywords: Linux CentOS Nginx Spring Boot

Added by HuggieBear on Mon, 31 Jan 2022 23:37:44 +0200