Fastdfs Token Validity Configuration instructions

Source: Internet
Author: User

Tracker on token configuration/etc/fdfs/http.conf:

# If use tokens to Anti-steal
# default value is False (0)
Http.anti_steal.check_token=true


# token TTL (Time to live), seconds
# Default value is 600
Http.anti_steal.token_ttl=60


# secret key to generate Anti-steal token
# This parameter must is set when Http.anti_steal.check_token set to True
# The length of the secret key should not exceed bytes
http.anti_steal.secret_key=fastdfs1234567890


# Return the content of the file when check token fail
# Default value is empty (no file sepecified)
Http.anti_steal.token_check_fail=/home/storage/anti-steal.jpg

The effective duration of configuring tokens in tracker is 60s

The configuration of tokens in storage/etc/fdfs/http.conf:

# If use tokens to Anti-steal
# default value is False (0)
Http.anti_steal.check_token=true


# token TTL (Time to live), seconds
# Default value is 600
Http.anti_steal.token_ttl=60


# secret key to generate Anti-steal token
# This parameter must is set when Http.anti_steal.check_token set to True
# The length of the secret key should not exceed bytes
http.anti_steal.secret_key=fastdfs1234567890


# Return the content of the file when check token fail
# Default value is empty (no file sepecified)
Http.anti_steal.token_check_fail=/home/storage/anti-steal.jpg

The effective duration of configuring tokens in storage is 60s

This is only in the Fastdfs of the effective time to configure token, in fact, the configuration will generally open the cache on Nginx, even if the Fastdfs on the validity of the token is over, but in the Nginx cache is also cached, then to access the pictures and other resources, Or from the cache on Nginx (tracker). The entrance to the file we visited is Nginx, so we will first look for the Nginx cache. If the cache in the tracker is not found, then go to storage on the search, storage to determine whether token is invalid, if not fail to return the resource information, the failure will return to the wrong page configuration.

Then look at the nginx cache configuration:

Proxy_buffer_size 16k;
Proxy_buffers 4 64k;
Proxy_busy_buffers_size 128k;
Proxy_cache_path/fastdfs/cache/nginx/proxy_cache levels=1:2 keys_zone=http-cache:500m max_size=10g inactive=30d;
Proxy_temp_file_write_size 128k; #设置缓存存储路径, storage mode, allocated memory size, disk maximum space, cache age
proxy_temp_path/fastdfs/cache/nginx/proxy_cache/tmp;

location/g2/m00 {
Proxy_next_upstream http_502 http_504 error timeout invalid_header; Proxy_cache Http-cache;
Proxy_cache_valid 304 12h;
Proxy_cache_key $uri $is_args$args;
Proxy_pass http://fdfs_group2;
Expires 30d;
}

The period configured for the cache is 30 days, and the file is saved for 30 days on tracker and then expires.

Ps:

Modified the configuration of the/etc/fdfs/http.conf, even if the storage (fdfs_storaged/etc/fdfs/storage.conf restart) is restarted, but the need to restart the Nginx to take effect (/usr/local/ Nginx/sbin/nginx-s Stop;/usr/local/nginx/sbin/nginx).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.