As a professional well-versed in the operation of AnQiCMS, I am well aware of the importance of modifying the configuration files for system stability and functionality. When you are dealing with AnQiCMS'sconfig.jsonWhen modifying files, the correct operation process and understanding of service restarts are crucial to ensure changes take effect and avoid potential issues.

In most cases, what we refer to isconfig.jsonThe file is the core configuration file located at the root directory of AnQiCMS installation. This file carries the basic settings for the AnQiCMS application to run, such as the system port being listened to (as mentioned in the document, the default)8001Port). Since these settings directly affect the application's network behavior and startup parameters, any modification requires a strict 'save and exit' procedure.

config.jsonAfter the file is modified, the 'Save and Exit' step.

Before doingconfig.jsonThe primary task in modifying a file is to locate this file. For most users, this file is located at the top level of your AnQiCMS installation directory. For example, if you are/www/wwwroot/anqicmsThe AnQiCMS is installed in the directory, thenconfig.jsonthe file should be at this path.

After finding the file, you need to open it with a text editor (such as Vim, Nano, Notepad++, VS Code, etc.).Under Linux server environments, command-line editors are usually used to connect via SSH; in the local Windows testing environment, you can directly find and open using your preferred editor through the file manager.

In the editor, you can modify the corresponding configuration items according to your needs. For example, if you need to change the listening port of AnQiCMS, you can findportTranslate the field and change its value to the new port number.After the modification is completed, be sure to perform the editor's "Save" operation to write the changes to disk.Then, you can safely close the text editor and complete the "exit" process.

Do you need to restart the service?

Forconfig.jsonThe modification of the file, the answer is clear:AnQiCMS service needs to be restarted for the configuration changes to take effect.

This is becauseconfig.jsonThe configuration items in the file are read and loaded when the AnQiCMS application starts.The application does not monitor the changes of this file in real time during its operation.Therefore, when you modify the port, database connection, or other core parameters, the running AnQiCMS instance will still use the old configuration.config.jsonFile, a new configuration must be recognized and applied by the application.

According to your deployment method of AnQiCMS, the method of restarting the service will be different:

  • Manual deployment of Linux server or command-line deployment:You usually need to stop the currently running AnQiCMS process first, and then restart it. The documentation mentioned instart.shandstop.shScript is designed for this purpose. You can execute./stop.shto stop the service, then execute./start.shto start the service.
  • Docker Deployment of Baota Panel/1Panel/aaPanelIf you are deploying AnQiCMS via the Docker feature of these panels, you usually need to enter the Docker management interface of the panel, find the corresponding AnQiCMS container, and then perform the 'restart' operation.
  • Taobao Panel Go project deployment:If you are running a Go project on Baota Panel, you can find the AnQiCMS project under 'Website' -> 'Go Project' on the Baota Panel, then click 'Stop', then click 'Start', or directly click the 'Restart' button.
  • Windows Local Test:In Windows environment, since there is no resident service script, you need to find and end theanqicms.exeprocess, then double-click.anqicms.exeRestart the application by re-launching the file.

After restarting the service, you should visit your website or back-end management interface to verify that the new configuration has been successfully applied.For example, if you have changed the port, please try to access your AnQiCMS website through the new port.

In summary, to the AnQiCMS coreconfig.jsonAny modification to the file requires you to manually save the changes and completely restart the AnQiCMS application to ensure that these changes are correctly read and effective by the system.


Common Questions and Answers (FAQ)

1. Modificationconfig.jsonWhat are the consequences if the service is not restarted?

If you have modified the AnQiCMS coreconfig.jsonIf the service is not restarted after the file, the configuration changes you have made will not take effect.The application will continue to run using the old configuration it loaded at startup.This may lead to application behavior not meeting expectations, such as being unable to access through the new port, or database connection failures, but it usually will not lead to data loss or system crashes.

2. Does AnQiCMS have other configuration modifications that also require restarting the service?

Yes, in addition toconfig.jsonOutside of this, many configuration changes involving the core functionality or global behavior of the application typically require restarting the AnQiCMS service to take effect.This includes but is not limited to: database connection information, file storage paths, certain security settings, or third-party service API keys, etc.Generally speaking, for any basic configuration that cannot be directly modified and take effect immediately in the background management interface, it should be considered to restart the service after manually modifying its configuration file.While configuration changes made through the backend interface (such as website name, SEO settings, navigation, etc.), AnQiCMS usually performs real-time updates or automatically clears the cache, without the need to manually restart the service.

3. The directory under the templateconfig.jsonDo you also need to restart the AnQiCMS service after modification?

The directory under the templateconfig.json(such as/template/default/config.json主要用于定义模板的元数据(name、version、author等)和启用状态(template_type/status)。Modify these information usually does not require restarting the entire AnQiCMS application. AnQiCMS will dynamically read template files and theirconfig.jsonor the configuration change can be refreshed through the "Update Cache" feature in the background management interface. Therefore, for the templateconfig.jsonThe modification, usually only requires re-selecting the template in the AnQiCMS backend or executing the 'update cache' operation, without the need to restart the AnQiCMS service.