All Products
Search
Document Center

Object Storage Service:Store remote attachments from a Discuz forum

Last Updated:Mar 20, 2026

Discuz! supports storing user-uploaded attachments on a remote FTP server instead of local disk. By pairing this built-in feature with OSS FTP (ossftp), you can route all attachment uploads directly to an OSS bucket—without changing how Discuz! works.

Prerequisites

Before you begin, ensure that you have:

  • A public-read OSS bucket. The bucket access control list (ACL) must be set to public-read. Private buckets are not supported for this integration—Discuz! retrieves attachment URLs directly from OSS, so a private bucket will break image and file display. For setup instructions, see Create a bucket. This guide uses a bucket named test-hz-jh-002 in the China (Hangzhou) region as an example.

  • ossftp installed and running. ossftp acts as the FTP gateway between Discuz! and OSS. For installation instructions, see Installation.

  • A Discuz! forum. Download Discuz! from the Discuz! official website. This guide uses Discuz! X3.1 as an example.

  • Your AccessKey ID and AccessKey secret. These credentials are used as the FTP username and password. To retrieve them, see Obtain an AccessKey pair.

Configure the remote attachment settings

  1. Log in to the Discuz! admin panel using an administrator account.

  2. Click Global, then click Upload Settings

  3. Click the Remote Attachment

  4. Configure the parameters as described in the following table.

    ParameterExample valueDescription
    Enable remote attachmentYesSet to Yes to enable remote attachment storage.
    Enable SSL connectionNoWhether to use SSL for the FTP connection.
    FTP server127.0.0.1Address of the server running ossftp. If ossftp runs on the same machine as Discuz!, enter 127.0.0.1.
    FTP server port number2048Port that ossftp listens on. Default: 2048.
    FTP accountY6IoUOZReouXvWaXuwjvDch9******/examplebucketFTP username in the format <AccessKeyID>/<BucketName>. The AccessKey ID must belong to an account that is granted permissions to access the bucket. To use a custom username instead, see Create custom logon users.
    FTP passwordsRaQg0i3SH9EqYXJSL1hlaR******Your AccessKey secret. To use a custom password instead, see Create custom logon users.
    Passive mode connectionYesMust be set to Yes for ossftp compatibility.
    Remote upload directory.Path prefix for uploaded files in OSS. A period (.) places files in the bucket root directory.
    Remote access URLhttps://test-hz-jh-002.oss-cn-hangzhou.aliyuncs.comPublic URL of your bucket, in the format https://<BucketName>.<Endpoint>.
    FTP timeout (seconds)0FTP connection timeout. 0 uses the server default.

Test and verify the configuration

Test the connection

Click Test Remote Attachment. Discuz! sends a test request to ossftp. If the test passes, the configuration is valid and you can proceed.

If the test fails, check the following:

  • ossftp is running and accessible on the configured host and port.

  • The bucket ACL is set to public-read, not private.

Confirm uploads reach OSS

  1. Post a new article in Discuz! and attach an image.

  2. After posting, right-click the image and choose Open Link in New Tab.

  3. Check the URL in the new tab. If the URL matches the format http(s)://<BucketName>.<Endpoint>/<path>/<filename>, the attachment was uploaded to OSS successfully. For example: https://test-hz-jh-002.oss-cn-hangzhou.aliyuncs.com/forum/201512/18/171012mzvkku2z3na2w2wa.jpg