dfs thumbnail

On the storage service operations (storge)

1. Installation dependent (st-01 st-02)

命令:[root@storage01 ~]# yum install -y pcre pcre-devel openssl openssl-devel gd-devel

命令:[root@storage02 ~]#yum install -y pcre pcre-devel openssl openssl-devel gd-devel

 

2. After the killing process compiling nginx nginx (with st-01 for example)

Command: [root @ storage01 ~] # ps aux | grep nginx

Command: [root @ storage01 ~] # kill -9 6462

 

3. Re-compile nginx, add a module

Command: [root @ storage01 ~] # cd /myself_settings/nginx-1.7.8

命令:[root@storage01 nginx-1.7.8]# ./configure --prefix=/usr/local/nginx --with-http_image_filter_module --add-module=/myself_settings/fastdfs-nginx-module/src

命令:[root@storage01 nginx-1.7.8]# make && make install

 

4. Analytical configuration nginx

Command: [root @ storage01 nginx-1.7.8] # vim /usr/local/nginx/conf/nginx.conf

The following configuration files are copied into it


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    65 keepalive_timeout;

    #gzip ON;

    Server {
        the listen 8080;
        server_name localhost;

        #charset KOI8-R & lt;

        #access_log logs / main host.access.log;
##

        LOCATION ~ Group [1-3] / M00 /(.+)_ . ([0-9] +) x ([0-9] +) \ (jpg | gif | png) {# this configuration down to a thumbnail generating
            the root / opt / fastdfs_storage_data / Data;
            ngx_fastdfs_module;
            SET $ 2 $ W;
            SET $ H $. 3;


            if ($w != "0") {
                rewrite group1/M00(.+)_(\d+)x(\d+)\.(jpg|gif|png)$ group1/M00$1.$4 break;
            }

            if ($h != "0") {
                rewrite group1/M00(.+)_(\d+)x(\d+)\.(jpg|gif|png)$ group1/M00$1.$4 break;
            }

            image_filter resize $w $h;

            image_filter_buffer 2M;

            try_files group[1-3]/M00$1.$4 $1.jpg;
      }
##
        location ~/group[1-3]/M00{
               root /opt/fastdfs_storage_data/data;
                 ngx_fastdfs_module;
          }



        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }                                    到此处结尾


        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        # location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

Command: [root @ storage02 nginx-1.7.8] # / usr / local / nginx / sbin / nginx # then restart files

Note: How many storage server (storage) to be configured, otherwise it will report 404

 

5. Test

Insert a picture into / root under

命令: [root @ ~ storage01] # / usr / bin / fdfs_test /etc/fdfs/client.conf upload /root/20200107204.png

 

 

 

Open your browser and enter http://192.168.175.10:8080/group1/M00/00/00/wKivCl4VntWAQjOrAAEpWNULvG4895_big.png

As shown below:

 

 

 

The screenshot above is the original, we have done a thumbnail, so we can set the standard size picture

Also in the browser open, in front of the same path, add back the size specifications  

Note: The suffix replaced by deleting big size specifications, 200x200 I tune into the middle of the "x" is not a lowercase x multiplication sign!

Enter: http: //192.168.175.10: 8080 / group1 / M00 / 00/00 / wKivCl4VntWAQjOrAAEpWNULvG4895_200x200.png

As shown below:

 

Such a thumbnail image server on the configuration FastDFS done

Guess you like

Origin www.cnblogs.com/xiaolei123/p/12167971.html
dfs