In the daily operation of websites, the security and recoverability of content are of great importance.Imagine if your website data suddenly disappeared, or if important images failed to display, how much trouble that would cause for operations.AnQiCMS (AnQiCMS) is an efficient content management system that provides many functions to help us properly manage website resources and ensure that we can recover quickly in the event of an accident.This article will delve into how to configure the resource storage and backup mechanism of Anqi CMS to maintain the continuous stable operation of the website.

1. Understand the resource storage structure of Anqi CMS

In AnQi CMS, the 'content' of the website does not only refer to the articles or product descriptions you publish, but also includes a large number of media files (such as images, videos) and the database data that supports the normal display of these contents.

  1. File resource storageAnqi CMS allows us to upload various media files such as images, videos, and provides unified "image resource management" in the background (as mentioned in the help document)图片资源管理使用帮助)。These files are uploaded and will be stored in a specific directory on the server. For example, in the Docker deployment scenario, files are usually located inside the Docker container's internal/app/A subdirectory under the directory, while in environments such as Baota panel, it may be/www/wwwroot/你的域名/uploadsThe path. Understanding the physical location of these files is the premise for effective management and backup.The AnQi CMS also provides image classification, replacement, and other management functions to help us better organize and maintain these files.

  2. Database data storageEach article, category, user, and configuration (such as system settings, contact information, navigation menu, SEO information, etc.) you create on the Anqin CMS backend is stored in the database.The Anqi CMS is developed based on Go language and is usually used with relational databases such as MySQL.The database is the core carrier of website content, its integrity directly relates to the normal operation of the website.

Second, strengthen the security of resource storage

Ensure the security of storage resources is the first line of defense against data leakage and malicious tampering. Anqi CMS enhances this security through various functions.

  1. File upload and anti-theft protectionThe AnQi CMS is built-in with the "Anti-crawling and Watermark Management" feature, which means that the original images you upload can be automatically added with watermarks and can prevent content from being maliciously collected to some extent.In addition, in the "Content Settings", you can configure whether to download remote images (to avoid introducing external unsafe resources), whether to enable WebP image format (to optimize storage and possibly reduce some attack surfaces), as well as whether to automatically compress large images, etc.These settings not only help improve website performance, but also indirectly enhance security at the file level.The system supports file upload with verification functions, which can effectively prevent malicious or non-compliant files from being uploaded.

  2. System-level permissions and technical supportThe Anqi CMS adopts a modular design and flexible permission control mechanism.This means you can assign fine-grained operational permissions to different administrator users, for example, restricting some users to only publish articles without the ability to modify the core configuration of the website or manage file resources.This permission separation greatly reduces the risk of internal errors or malicious actions.At the same time, Go language, as its development foundation, reduces many common security vulnerabilities at the bottom level with its memory safety and concurrency features.Under the multi-site management mode, each site can be configured with an independent database or data directory, further isolating data risks between different sites and avoiding the situation where 'a loss is a loss for all.'

3. Build a reliable resource backup and recovery mechanism

Even with strong security measures, data backup is still an indispensable part of website operations.It is the last line of defense against hardware failures, software errors, human errors, and even network attacks.AnQi CMS explicitly points out the advantages in the project, emphasizing the provision of resource storage configuration, system data backup and recovery, and data security. This feature is crucial for the recoverability of the website.

  1. Regular file backupBecause images, videos, and other media files are an important part of the website content, regularly backing up the website's file storage directory is crucial.These files are usually concentrated in a folder such as 'uploads' or 'public/static' under the 'Anqi CMS' project directory.You can choose to manually copy these directories, a more recommended approach is to use the backup function provided by the server management panel (such as Baota panel, 1Panel) or through command line tools (such asrsync/tarSet up a scheduled task to package these directories and transfer them to a secure storage location.

  2. Key database backupThe database is the 'brain' of the website, and its backup work is even more critical.All text content and configuration information of AnQi CMS are stored in the database.You should regularly use the built-in backup tool of the database (for example, MySQL'smysqldumpCommand) or the server management panel's database backup feature, create a complete backup file for the database.If your AQI CMS has deployed multiple sites and each site uses an independent database, then you must definitely make a separate backup for the database of each site.

  3. Establish a recovery strategyThe ultimate purpose of backup is to recover. Therefore, having a clear recovery strategy is crucial.

    • Fast recoveryWhen your website encounters data loss or service interruption, you need to know how to quickly restore the website to normal status using the latest backup file.This usually involves importing the database backup into a new (or cleaned) database and restoring the file backup to the website file directory.
    • Off-site backupStore the backup files in a physical location different from the website server (for example, cloud storage, another server), which can effectively resist regional disasters or overall server failures.
    • Test recovery planRegularly perform recovery tests to ensure that backup files are complete and usable, and be familiar with the recovery process. This ensures that you can complete the recovery operation in an orderly manner when truly needed.

Four, Implementation Suggestions and Practice

To maximize the security and recoverability of the Anqi CMS website, the following suggestions can help you establish a robust mechanism:

  • The automated backup is preferred: Using the server's scheduled tasks (such as Linux's crontabOr the scheduling task function of Baota/1Panel and other panels, which automatically executes file and database backup scripts. This can reduce manual intervention and prevent omissions.
  • Versioned backup strategyDo not keep only one backup. It is recommended to keep at least daily backups for the past week, as well as weekly backups for the past month.Even if the latest backup is damaged or contains incorrect data, you can trace back to an earlier available version.
  • Monitor backup tasks: Regularly check the execution log of backup tasks to ensure that each backup is successfully completed and that the size and content of the backup files are as expected.
  • Encrypt sensitive dataIf the backup file contains sensitive user information, consider encrypting the backup file to further enhance data security.

By deeply understanding and practicing the security CMS resource storage and backup strategy, you can build a solid defense for your website content, ensuring that the website can recover safely and quickly in any unexpected situation, and minimize potential losses as much as possible.


Frequently Asked Questions (FAQ)

  1. Q: Where are the website files of AnqiCMS stored, and which directories do I need to backup?A: Static resources (such as images, videos, attachments, etc.) of AnQi CMS are usually stored in the root directory of the project.uploadsorpublic/staticIn the directory. The specific path may vary depending on the deployment method (such as Docker, Baota panel), it is recommended that you log in to the server and check the actual directory structure of AnqiCMS for confirmation.When backing up, be sure to include these resource directories and your database.If you use the multi-site feature, please note that each site may use an independent file storage directory or database, and you need to back up separately.

  2. Q: How to set up automated backup?A: Automated backups are usually completed through the server's scheduled tasks.

    • For Linux serversYou can usecrontabCommand editing scheduled tasks, writing scripts to package (tar) File directory and export database (mysqldump), then transfer the packaged file to an off-site storage.
    • For Baota panel/1Panel usersThese panels usually provide graphical "scheduling tasks" or "backup" functions, where you can directly configure daily or weekly automatic backup of website files and databases, and choose to backup to cloud storage or other locations.
  3. Q: How can I recover from data loss on a website using backups?A: The recovery steps usually include:

    1. Stop the website service: Prevent data from continuing to be written or causing confusion during recovery.
    2. Clean up existing data: Depending on the situation, it may be necessary to clear the website file directory and/or delete all tables in the existing database.
    3. Restore file: Unzip the latest file backup and overwrite the file storage directory of the website.
    4. Restore database: Import the latest database backup file into the database (for example, usingmysql -u 用户名 -p 数据库名 < 备份文件.sqlCommand).
    5. Check the configuration: Confirmconfig.jsonCheck if the database connection information, website URL, and other configurations in the configuration file are correct.
    6. Start the website service: Restart your AnqiCMS service.
    7. Verify: Visit the front and backend of the website and check if the content is complete and the functions are normal.

Be sure to verify the integrity of the backup before performing the recovery operation and conduct recovery tests in a non-production environment.