Fastdfs enables token anti-leech Protection

Source: Internet
Author: User

Environment:

Fastdfs

Nginx + ngx_fastdfs_module

PHP + fastdfs_php Extension

Enable token:

VI/etc/fdfs/HTTP. conf

# Enable

HTTP. anti_steal.check_token = true

# Key

HTTP. anti_steal.secret_key = 123456

Restart nginx

In PHP, $ token is generated through the fastdfs_http_gen_token () function, for example:

$ Ts = Time (); // current Timestamp
$ Token = fastdfs_http_gen_token ('m00/00/00/Ss_0rVGSABmAEZ1QAAC6WE5-JkI695.zip ', $ TS );

Then the URL is like:

Http: // localhost/m00/00/00/Ss_0rVGSABmAEZ1QAAC6WE5-JkI695.zip? Token = 8de0e6554be69d0b9425faad654c4364 & TS = 1368589809

In this way, the server can automatically verify validity Based on the token, ts, And the set key. Set the key expiration time in HTTP. conf.

Problem:

The token always fails to be verified. Check the following:

1. fastdfs_http_gen_token ($ file_name, $ timestmp); $ file_name must not contain group_name

2. Do you forget to set a key in the configuration file corresponding to the client, which must be consistent with that in HTTP. conf, such as the fastdfs_client.http.anti_steal_secret_key parameter in PHP. ini.

3. Check that the time between your fdfs server and the client server does not differ by minutes.

Fastdfs enables token anti-leech Protection

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.