Store remote attachments from a Discuz forum

更新时间:
复制 MD 格式

The remote attachment feature lets you use FTP to store user-uploaded attachments on a remote server. Many platforms, such as Discuz forums, PHPWind forums, and WordPress sites, support this feature. This topic describes how to store remote attachments from a Discuz forum in OSS.

Prerequisites

  • A bucket with public-read permissions has been created. For more information, see Create buckets.

    This topic uses a bucket named test-hz-jh-002 in the China (Hangzhou) region as an example.

  • OSS FTP has been installed. For more information, see Install OSS FTP.

  • A Discuz forum has been set up. To download the software, see Discuz!ᵂ Official Site.

    This topic uses Discuz! X3.1 as an example.

Procedure

  1. Log on to your Discuz site with an administrator account.

  2. On the management page, click Global and then click Upload Settings.

  3. Click Remote Attachment and then set the remote attachment parameters.

    Parameter

    Example value

    Description

    Enable remote attachment

    Yes

    Specifies whether to enable remote attachments.

    Enable SSL connection

    No

    Specifies whether to enable the SSL connection.

    FTP server address

    127.0.0.1

    The address where OSS FTP is running. If OSS FTP runs on your local machine, enter 127.0.0.1.

    FTP server port

    2048

    The port that OSS FTP uses to accept access requests. The default port is 2048.

    FTP account

    Y6IoUOZReouXvWaXuwjvDch9******/examplebucket

    The username to connect to OSS FTP. The username consists of the AccessKey ID that has permissions to access the bucket and the bucket name. The format is AccessKey ID/BucketName. For more information about how to obtain an AccessKey ID, see Create an AccessKey.

    Note

    You can customize the logon username. For more information, see Create a custom logon user.

    FTP password

    sRaQg0i3SH9EqYXJSL1hlaR******

    The password to connect to OSS FTP. The password is the AccessKey secret that has permissions to access the bucket. For more information about how to obtain an AccessKey secret, see Create an AccessKey.

    Note

    You can customize the logon password. For more information, see Create a custom logon user.

    Passive mode (PASV) connection

    Yes

    Select Yes.

    Remote attachment directory

    .

    The path in OSS where the FTP service creates the upload directory for remote attachments. A period (.) indicates that the upload directory is created in the root directory of the bucket.

    Remote access URL

    https://test-hz-jh-002.oss-cn-hangzhou.aliyuncs.com

    The access URL of the bucket. The format is https://BucketName.Endpoint.

    FTP transfer timeout

    0

    Set the value to 0 to use the server's default timeout period.

  4. Click Test Remote Attachment to confirm that the configuration is valid.

  5. Create a post to verify that the configuration is successful.

    1. Upload an image attachment when creating the post.

    2. Right-click the image and select Open link in new tab.

      If the image URL is in the format http(s)://BucketName.Endpoint/path/filename, the attachment was uploaded successfully.

      For example, the image URL in this topic is https://test-hz-jh-002.oss-cn-hangzhou.aliyuncs.com/forum/201512/18/171012mzvkku2z3na2w2wa.jpg.