What is the complete procedure for saving and exiting the configuration and making the new port effective after modifying the `port` port of each site in the multi-site configuration?

Calendar 👁️ 60

As a senior Anqi CMS website operations personnel, I am well aware of the importance of multi-site management for efficient operation.When you need to deploy multiple independent AnQiCMS instances on the same server and want each instance to listen on a different port, it indeed requires a clear operation procedure.Let's go through it in detail on how to modify and make the port effective for each AnQiCMS site.

Understand the difference between multi-site and multi-instance

Before we start, we need to clarify the two "multi-site" modes supported by AnQiCMS. One is the built-in multi-site management feature of AnQiCMS, which allows you toAn AnQiCMS program instanceBelow, through backend configuration and reverse proxy, manage multiple domain names and independent website data.In this mode, all sites share the same AnQiCMS process, so there is no need to modify the port for each site.

The requirement you proposed - 'Modify each site'portPort', which actually refers to running on the same serverMultiple independent AnQiCMS program instancesEach instance has its own code copy, independent database, and listens on different ports.This pattern is often used for development, test environment isolation, or special business requirements.We will elaborate on this multi-instance, multi-port configuration.

Complete process of modifying the port and making the new site effective

When you decide to allocate a unique port for each AnQiCMS instance, the following detailed steps should be followed to ensure that the new port configuration can be saved and put into use smoothly.

First, make sure you have at least one AnQiCMS instance running and are familiar with your server file system and the reverse proxy configuration of web servers such as Nginx or Apache.

1. Copy AnQiCMS program code

Firstly, you need to prepare a separate runtime environment for the new AnQiCMS instance. Find the installation directory of your existing AnQiCMS instance, for example/www/wwwroot/anqicms.com. Then, create a new directory on your server, for example/www/wwwroot/newsite.com, and move all files and folders from the original AnQiCMS installation directoryto the new directoryCopy it completely to this new directory. This is because each independent instance needs to have its own code copy.

2. Modify the configuration file of the new instance.

In the AnQiCMS directory created, locate toconfig.jsonthe file. This file contains the core configuration information of the AnQiCMS instance. Open it with a text editor.

Inconfig.jsonIn the file, you will find a namedportconfiguration item, whose default value is usually8001. You need to change this value to one that is currently on the serverNot occupiedThe new port number. For example, if your first instance uses8001then the new instance can use8002the next instance can use8003and so on.

Be sure to save after modificationconfig.jsonFile. This step is to inform the new AnQiCMS instance which port it should listen on to provide services.

3. Configure the database information for the new instance.

Since this is a new AnQiCMS instance, it requires an independent database to store data.You need to create a new database on your database server (such as MySQL) and set up the corresponding user and password.

Then, go back to the new instance'sconfig.jsonFile (or through the Web interface during the first visit), find the database-related configuration items (such asDB_NAME,DB_USER,DB_PASS,DB_HOSTWait).Update these configuration items based on the database information you have just created. Make sure each independent AnQiCMS instance points to its own database to avoid data conflicts.

4. Rename the executable file (recommended)

It is strongly recommended for easy management and differentiation of different AnQiCMS processes to place the AnQiCMS executable file (usually on Linux) in the installation directory of a new instance.anqicmsRename to a more identifiable name, such asnewsite_anqicms.

This step is not mandatory, but it can effectively avoid confusion when you need to manage a specific AnQiCMS instance through the command line or task manager.

5. Configure startup script and task scheduler for new instance

To ensure that your new AnQiCMS instance can automatically start after the server restart and remain stable during operation, you need to configure its startup script and task scheduler.

Find the original AnQiCMS instance ofstart.shandstop.shScript (if used), copy it to the directory of the new instance. Then, edit these scripts and update theBINPATH(program path) andBINNAME(Executable file name) variable, making it point to the directory of the new instance and the renamed executable file.

Next, rename the new instance'sstart.shAdd the script to the server's task scheduler (for example, using Linux oncrontab -eAdd an entry that runs every minute, or add it through the task scheduler feature of Baota panel/1Panel).This system will check regularly and ensure that your new AnQiCMS instance is running.

After the configuration is complete, manually run a newstart.shscript to start your new AnQiCMS instance.

6. Configure Web Server Reverse Proxy

Since your AnQiCMS instance is now listening on a non-standard Web port (such as8002),users cannot access directly through the domain name. You need to set up a reverse proxy through a web server (Nginx or Apache) to route users through standard HTTP/HTTPS ports(80/443) Forward requests to the port that the new AnQiCMS instance is listening on for the new domain.

  • Nginx configuration example:Create a new Nginx server block file (for example/etc/nginx/conf.d/newsite.com.conf), the content is similar to the following:

    server {
        listen 80;
        server_name newsite.com www.newsite.com; # 替换为您的新域名
        root /www/wwwroot/newsite.com/public;   # 指向新实例的public目录
    
        location @AnqiCMS {
            proxy_pass http://127.0.0.1:8002; # 替换为新实例的端口
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
        error_page 404 =200 @AnqiCMS;
        location / {
           try_files $uri $uri/index.html @AnqiCMS;
        }
    }
    

    Make surerootThe path points to a new instance ofpublicdirectory, andproxy_passthe port number in it matches theconfig.jsonnew port you set in

  • Apache configuration example:For Apache, you need to configure the site configuration file (such ashttpd-vhosts.confOr by adding rules similar to the following through the Baota panel's reverse proxy settings:

    `apache

    ServerName newsite.com
    ServerAlias www.newsite.com
    DocumentRoot /www/wwwroot/newsite.com/public # 指向新实例的public目录
    
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ http://127.0
    

Related articles

What are the correct steps to 'save and exit' after modifying the 'config.' file in AnQiCMS, and do you need to restart the service?

As a professional who deeply understands the operation of AnQiCMS, I know the importance of modifying the configuration file for system stability and functional implementation.When you modify the `config.` file of AnQiCMS, the correct operation procedure and understanding of service restart are the key to ensuring that changes take effect and avoid potential risks.The `config.` file is typically located in the root directory of the AnQiCMS installation, which is the core configuration file.This file carries the basic settings for the AnQiCMS application running

2025-11-06

How to verify that the AnQiCMS service can automatically start after saving and exiting the `start.sh` script added to crontab?

The automatic startup verification method of AnQiCMS is crucial to ensure that core services can run stably and automatically in website operations.For AnQiCMS, configuring the `start.sh` script to the `crontab` is to automatically restore its running state after system startup or accidental service termination, ensuring the continuous availability of the website.Complete the configuration of the `start.sh` script and add it to `crontab`, and the detailed verification steps are crucial to ensure that this automation mechanism works as expected.

2025-11-06

If the "ws save and exit" mentioned in the AnQiCMS document is a typo for `wq`, what is the difference between `wq` and `x` in Vim for saving and exiting?

As an experienced security CMS operator in the field of content management for many years, I fully understand the importance of every detail to the efficiency of content work, whether it is the content creation itself or the technical operations behind it.When dealing with template files, optimizing content snippets, or configuring system scripts, we often deal with various command-line tools, and Vim editor is one of them.

2025-11-06

How to correctly execute 'Save and Exit' after modifying the scheduled task of AnQiCMS on a Linux server to ensure the task takes effect?

As an experienced CMS website operation personnel of an information security company, I am well aware of the importance of managing scheduled tasks on Linux servers for system stability and automated operation and maintenance.When you need to adjust the Anqin CMS schedule task, whether it is to schedule the application to start, execute the data backup script, or handle other custom automation processes, ensuring that the modified task takes effect correctly is crucial.This process usually involves the Linux system's `crontab` tool and the correct operation of its built-in editor.###

2025-11-06

Does clicking 'Save' in the AnQiCMS backend after modifying system settings or content settings equivalent to 'Save and Exit' at the file level and take effect immediately?

As an experienced CMS website operation person in the security industry, I know that an accurate understanding of system behavior is crucial for efficient operation when performing operations in the background.About the issue you raised, "AnQiCMS" background modification of system settings or content settings, after clicking "Save", is it equivalent to "Save and Exit" at the file level and take effect immediately?This issue can be explored in detail from several aspects.In the daily operation of Anqi CMS, the "Save" button on the backend usually executes the operation of writing data to the database.Whether we updated the content of an article or adjusted the description of a category

2025-11-06

How does the 'save and exit' mechanism ensure service persistence after checking 'start on boot' in the 'Go project' on the Baota panel and configuring AnQiCMS?

As a website manager who deeply understands the operation of Anqi CMS, I understand your concerns about service persistence and website stability.In the "Go projectAnQiCMS as an enterprise-level content management system developed based on the Go language has laid a solid foundation for the stability of the service.

2025-11-06

How to replace the manual 'save and exit' with the container restart rules (such as 'restart on failure') when deploying AnQiCMS with Docker to ensure high availability?

As a professional who is well-versed in the operation of AnQiCMS, I understand the importance of the stable operation of a content management system, which directly relates to the efficiency of content publishing, user experience, and the overall business performance of the website.In modern website architecture, Docker has become a powerful tool for deploying AnQiCMS, and one of its core advantages is the container restart strategy, which not only replaces the繁琐 of traditional manual operations but also is the foundation for high availability.### From manual operation to intelligent restart: The innovation of operation and maintenance mode Before the popularity of Docker technology

2025-11-06

After modifying the reverse proxy configuration of Apache or Nginx, what commands need to be executed after performing the "Save and Exit" operation to make the AnQiCMS site accessible?

When managing the AnQiCMS site, you may need to adjust the reverse proxy configuration of Apache or Nginx according to your requirements.These configuration modifications, whether it is to change the domain name, port mapping, SSL certificate settings, or optimize performance rules, require specific operations to take effect on the web server.Saving and exiting the configuration file will not immediately make your site run normally. The web server needs to be informed of these changes and reload the configuration.

2025-11-06