As an experienced AnqiCMS website operations personnel, I am very happy to be able to elaborate on how to install and deploy AnqiCMS on a Linux server.AnqiCMS is a lightweight enterprise content management system developed based on the Go language, with its high efficiency, security, and SEO-friendly features, it has become a powerful tool for our content operation team.This article will guide you through the installation and deployment process in the Linux environment, ensuring that your website can go online quickly and run stably.
Install and deploy AnqiCMS on a Linux server
AnqiCMS content management system (AnqiCMS) provides powerful content management functions for small and medium-sized enterprises and content operators with its concise and efficient architecture and good use of the high concurrency characteristics of the Go language.The deployment process is designed to be simple and easy to follow, even if you are not a professional system administrator, you can easily complete it through this guide.
Before starting the installation of AnqiCMS, please make sure you have prepared a server running a Linux operating system.AnqiCMS supports including Ubuntu, CentOS, Red Hat, Debian and other mainstream Linux distributions based on X86.At the same time, you need to have basic knowledge of Linux command line operations and it is recommended to install MySQL database (version 5.6.35 and above) and a web server (such as Nginx or Apache) for reverse proxy in advance.
Get the AnqiCMS installation package
First, you need to download the installation package suitable for the Linux environment from the AnqiCMS official website. Please visithttps://en.anqicms.com/downloadSelect and download the latest Linux version installation package, usually a.zipformatted compressed file.
Two main ways to deploy AnqiCMS
We will introduce two methods for deploying AnqiCMS on Linux servers: the recommended deployment using the Baota panel (or a similar visual management panel) and manual deployment suitable for a pure command-line environment.
Method one: Deploy through the Baota panel (recommended)
Baota panel is a simple and easy-to-use server operation and maintenance management tool, which can greatly simplify the software installation and configuration process on Linux servers.This tutorial will be based on Baota panel for explanation, please make sure your Baota panel version is above 7.9.3 to get the **experience.
Step one: Create a directory and upload the installation package
- Log in to your Baota panel.
- Click the "Files" option in the left menu to navigate to
/www/wwwroot/Directory. - Create a new folder under this directory, it is recommended to name it after the domain name of your future website, for example
yourdomain.com. - Enter the folder you just created (
yourdomain.comThen click the 'Upload' button at the top of the Baota panel, upload the AnqiCMS Linux installation package you downloaded (anqicms-linux-v3.x.x.zip) to this directory. - After uploading, right-click on the installation package file, select 'Extract', and unzip it into the current directory.
Step two: Add AnqiCMS to the Go project
- In the left menu of the Baota panel, click the 'Website' option.
- In the website management interface, find and click on the "Go Project" tab (if you can't find it, please check whether the B塔panel settings have hidden this feature).
- Click the "Add Go project" button and fill in the following information in the pop-up configuration window:
- Project executable file:Enter the full path of the executable file after extracting AnqiCMS, for example
/www/wwwroot/yourdomain.com/anqicms. - Project name:Enter a recognizable name, for example
AnQiCMS_YourDomain. - Project port:Enter the port that AnqiCMS service listens to, the default is
8001Ensure that each instance uses a different port if you plan to deploy multiple AnqiCMS instances on the same server. - Execute the command:Please fill in the complete path of the project execution file, i.e.
/www/wwwroot/yourdomain.com/anqicms. - Run user:Select
www. - Check the "Boot up" option.
- Bind domain:Enter the domain name you have resolved to this server.
- Project executable file:Enter the full path of the executable file after extracting AnqiCMS, for example
- Click the 'Submit' button to complete the addition of a Go project. The Baota panel will automatically configure reverse proxy and守护进程 for you.
Step three: Initialize the installation of AnqiCMS
- Open your web browser and enter the domain bound to your Baota panel (for example
http://yourdomain.com/) - You will see the initialization installation interface of AnqiCMS.On this page, you need to fill in the database connection information (MySQL database address, port, username, password), and set up an administrator account and password for the AnqiCMS backend.
- Make sure the database information is accurate and that the database user has the permissions to create databases and tables. If you encounter any issues, please check the database connection string or user permissions.
- After completing the information entry, click the installation button. If everything goes well, AnqiCMS will complete the initialization and prompt for successful installation.
Deploy multiple AnqiCMS sites on a server:
AnqiCMS supports multi-site management, allowing you to manage multiple independent websites under a single AnqiCMS instance. If you need to deploy multiple sites on the same server, please follow the following steps:
Create a PHP project on Baota panel:Add a new PHP site in the 'Website' -> 'PHP Project' section of Baota panel. Fill in the domain name of the new site, for example
seconddomain.com. Remember the root directory, choose not to create FTP and database, and select 'Static' for PHP version.Add a new site in the AnqiCMS backend:Log in to the default site admin panel of AnqiCMS you have installed. Find the "Multi-site Management" feature in the left menu and click "Add New Site".
- Site Name:Fill in according to actual circumstances.
- Site root directory:Fill in with
/app/starting, add your domain name (replace dots with underscores), for example/app/seconddomain_com. This directory is used to store the cache and other data of new sites, make sure it does not duplicate the existing site directory. - Website address:Enter the complete URL of the new site, for example
http://seconddomain.com. - Admin account password:Set up an independent backend admin account and password for the new site.
- Database name:Specify a new database name for the new site, for example
seconddomain_anqicmsThe same period is replaced with an underscore to avoid conflicts. - Database information reuse: Tick the box “Reuse default database account information”, because Docker deployment usually has all database permissions.
- Select the template to use:Select the template you want to use for the new site.
Configure the Nginx pseudo-static of the new site:Return to the Baota panel, in the newly created website(
seconddomain.com) click "Settings" in the operation bar.- Enter the "Website Directory" tab and change the runtime directory
/publicand save. - Switch to the "URL Rewrite" tab and fill in the following Nginx rewrite rules and save:
location @AnqiCMS { proxy_pass http://127.0.0.1:8001; # 注意:这里应填写您AnqiCMS主实例的端口 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; }If you are using Apache, you should choose reverse proxy, enter the target URL
http://127.0.0.1:8001.- Enter the "Website Directory" tab and change the runtime directory
After completing the above steps, your new site can be accessed directly through the corresponding domain.You can quickly access the admin panel of the new site by clicking the 'Access Backend' button in the AnqiCMS multi-site management list.
Method two: manually deploy AnqiCMS via command line
If you do not use Baota panel or prefer command-line operations, you can manually deploy AnqiCMS according to the following steps.This method is applicable to the LNMP environment or to a server environment compiled manually.
Step one: Download and extract the AnqiCMS installation package
- By
wgetorcurlThe command downloads the AnqiCMS Linux installation package to your server.wget https://en.anqicms.com/download/anqicms-linux-v3.x.x.zip - Unzip the installation package to the directory where you want to store the website files, for example
/www/wwwroot/yourdomain.com.
Please replaceunzip anqicms-linux-v3.x.x.zip -d /www/wwwroot/yourdomain.com cd /www/wwwroot/yourdomain.comanqicms-linux-v3.x.x.zipwith the actual filename you downloaded.
Step two: Configure the AnqiCMS running environment
- Set up the startup script:The AnqiCMS installation package usually includes
start.shandstop.shscripts to start and stop the service. Please check these two scripts to ensure thatBINPATHandBINNAMEthe variables point to the correct path and executable filename. - Add a Scheduled Task (Cron Job):To ensure that the AnqiCMS service can automatically start and continue running after the server restarts, you can add a Cron Job to monitor and start the service.
In the open editing interface, add the following line of command:crontab -e
This will make*/1 * * * * /www/wwwroot/yourdomain.com/start.shstart.shThe script will run every minute to check if AnqiCMS is running, and if not, it will start it. - Manually start AnqiCMS:Manually execute once after adding the scheduled task
start.shThe script starts AnqiCMS service immediately:./start.sh
Step three: Configure Nginx reverse proxy
You need to configure Nginx to proxy external requests to the port that AnqiCMS is listening on (default is 8001).
Edit your Nginx site configuration file (usually located
/etc/nginx/conf.d/or/etc/nginx/sites-available/in the directory).In
serverblock, add the following configuration. Make sure to replaceyourdomain.comwith your actual domain, and also replacerootThe path points to AnqiCMS'spublicDirectory.server { listen 80; server_name yourdomain.com www.yourdomain.com; # 您的域名 root /www/wwwroot/yourdomain.com/public; # AnqiCMS的public目录 location @AnqiCMS { proxy_pass http://127.0.0.1:8001; # AnqiCMS服务监听的端口 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; } access_log /var/log/nginx/yourdomain.com.access.log; # 访问日志路径 error_log /var/log/nginx/yourdomain.com.error.log; # 错误日志路径 }After saving the Nginx configuration file, restart the Nginx service to make the configuration take effect.
nginx -t # 检查配置语法 systemctl restart nginx # 重启Nginx (或 service nginx restart)
**Steps