All Products
Search
Document Center

Object Storage Service:How to store remote attachments from Discuz! to OSS

Last Updated:Oct 22, 2024

You can use the FTP method to store the attachments that are uploaded to the Discuz! forum, PHPWind forum, or WordPress website to remote FTP servers. This topic describes how to store remote attachments from Discuz! to OSS.

Prerequisites

  • A bucket whose access control list (ACL) is public-read is created. For more information, see Create a bucket.

    In this topic, a bucket named test-hz-jh-002 that resides in the China (Hangzhou) region is used.

  • ossftp is installed. For more information, see Installation.

  • A Discuz! forum is created. For more information about the download address, see Discuz! official website.

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

Procedure

  1. Log on to the Discuz! website by using an administrator account.

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

  3. Click the Remote Attachment tab and configure the parameters. The following table describes the parameters.

    Parameter

    Example value

    Description

    Enable remote attachment

    Yes

    Specifies whether to enable remote attachments.

    Enable SSL connection

    No

    Specifies whether to allow SSL connections.

    FTP server

    127.0.0.1

    The address of the server that runs ossftp. To run ossftp on the local computer, enter 127.0.0.1.

    FTP server port number

    2048

    The port that receives requests for ossftp. Default value: 2048.

    FTP account

    Y6IoUOZReouXvWaXuwjvDch9******/examplebucket

    The username that you want to use to connect to ossftp. The username consists of the AccessKey ID of the account that is granted permissions to access a bucket and the name of the bucket in the AccessKey ID/BucketName format. For information about how to obtain an AccessKey ID, see Obtain an AccessKey pair.

    Note

    You can change the username that you use for logons. For more information, see Create custom logon users.

    FTP password

    sRaQg0i3SH9EqYXJSL1hlaR******

    The password that you want to use to connect to ossftp. Enter the AccessKey secret of the account that is granted permissions to access the bucket. For more information about how to obtain an AccessKey secret, see Obtain an AccessKey pair.

    Note

    You can change the password that you use for logons. For more information, see Create custom logon users.

    Passive mode connection

    Yes

    Specifies whether to allow passive mode connections. Set this parameter to Yes.

    Remote upload directory

    .

    The upload directory that is created for remote attachments by the FTP service in the specified path of OSS. The value of 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 URL that you want to use to access the bucket. The URL is in the https://BucketName.Endpoint format.

    FTP timeout (seconds)

    0

    The value of 0 indicates that the default timeout period of the server is used.

  4. Click Test Remote Attachment to check whether the configuration takes effect as expected.

  5. Post a new article to check whether the configuration is successful.

    1. Upload an image attachment for the article.

    2. Right-click the image and choose Open Link in New Tab from the shortcut menu.

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

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