As an experienced website operator, I know the importance of a stable and efficient content management system for the development of a company.AnQiCMS with its excellent performance in Go language and many enterprise-level features, has become an ideal choice for many small and medium-sized enterprises and content operation teams.Deploy AnQiCMS on a Linux server can fully utilize its high performance and security advantages.The following, I will elaborate on the steps and key points of manually deploying AnQiCMS on a Linux server, aiming to help you smoothly set up and run your content platform.
Manual deployment of AnQiCMS on Linux server
Deploy AnQiCMS on a Linux server requires a series of detailed steps to ensure the stable operation of the system and to maximize its performance.We will explain step by step from the environment preparation, file processing, core service configuration, to the final reverse proxy setup.
English preparation: Deploy environment and necessary components
Before deploying AnQiCMS, your Linux server needs to be properly configured with some basic environments and software components.First, your server should be based on an X86 architecture Linux distribution, such as Ubuntu, CentOS, or Debian, etc.Additionally, ensure that you have SSH access permissions to operate the server via command line and be ready with an FTP or SCP tool for file transfer.
Databases are the core of any content management system, AnQiCMS requires the backend database to be MySQL 5.6.35 or higher version.Please make sure to install and configure the MySQL service in advance, and prepare a MySQL user with database creation and management permissions (usually the root user or a user specifically created for AnQiCMS).
To expose AnQiCMS service to internet users, you also need a web server as a reverse proxy.Nginx and Apache are excellent choices, they can forward requests from port 80 (HTTP) or port 443 (HTTPS) to the internal ports where AnQiCMS is running.Ensure that one of the web servers is installed and running.
Obtain AnQiCMS installation package
The first step in deployment is to download the latest Linux installation package from the AnQiCMS official website. Please visit the official download pagehttps://en.anqicms.com/download,select the distribution package suitable for the Linux system (usually)anqicms-linux-vX.X.X.zipor.tar.gzformat). Download this package to your local computer.
file upload and unzipping
Download completed, you need to upload the AnQiCMS installation package to the Linux server. It is recommended that you in/www/wwwroot/The directory under is created for your AnQiCMS site, for example/www/wwwroot/yourdomain.com. Use the SCP tool or FTP client to upload the installation package to this newly created directory.
After the file upload is complete, log in to your server via SSH, enter the directory, and use the corresponding command to unzip the installation package. If the download is.zipfile, you can useunzip anqicms-linux-vX.X.X.zipcommand;if it is.tar.gzfile,then usetar -xzvf anqicms-linux-vX.X.X.tar.gzcommand. After unzipping, you will see the core files of AnQiCMS, includinganqicmsexecutable files and related scripts and template files.
Database configuration and initialization
AnQiCMS initialization process will be automatically guided when you visit it for the first time through the browser.When you have completed the subsequent Web server configuration and opened the AnQiCMS site for the first time, the system will prompt you to enter the database connection information.127.0.0.1)、port(default as3306)、Database name, as well as the MySQL username and password with the corresponding permissions.Moreover, you will also set up the website administrator account and password, as well as the access address of the website.Ensure that all information is accurate and error-free, as incorrect database credentials or insufficient permissions may cause the installation to fail.
AnQiCMS process guardian
To ensure that AnQiCMS service can run continuously and stably, even if the server restarts or the program exits unexpectedly, it can automatically recover, we need to set up a process guard mechanism. The AnQiCMS installation package providesstart.shandstop.shScript for starting and stopping services.
Firstly, you need to add the executable file path of AnQiCMS to your.start.shscript. Assuming AnQiCMS is extracted to/www/wwwroot/anqicms.com/Index, and the executable file name isanqicmsso thatstart.shThe script should be configured as follows:
#!/bin/bash
### check and start AnqiCMS
# author fesion
# the bin name is anqicms
BINNAME=anqicms
BINPATH=/www/wwwroot/anqicms.com # 请替换为您的AnQiCMS实际安装路径
# check the pid if exists
exists=`ps -ef | grep '\<anqicms\>' |grep -v grep |wc -l`
echo "$(date +'%Y%m%d %H:%M:%S') $BINNAME PID check: $exists" >> $BINPATH/check.log
echo "PID $BINNAME check: $exists"
if [ $exists -eq 0 ]; then
echo "$BINNAME NOT running"
cd $BINPATH && nohup $BINPATH/$BINNAME >> $BINPATH/running.log 2>&1 &
fi
Next, use Linux'scrontabtools to execute periodicallystart.shScript, to achieve process guardian. Open the crontab editor:
crontab -e
In the opened editor interface, add the following line to check and start AnQiCMS every minute (if it is not running):
*/1 * * * * /www/wwwroot/anqicms.com/start.sh
Save and exitcrontabEditor. After adding a plan task, to immediately start the AnQiCMS service, you can manually execute oncestart.shScript:
cd /www/wwwroot/anqicms.com
./start.sh
Configure the web server reverse proxy
AnQiCMS runs by default on an internal port (usually)8001)。To allow external users to access your website via domain name, you need to configure the web server (Nginx or Apache) as a reverse proxy to forward external requests to the internal port of AnQiCMS.rootThe directory points to the AnQiCMS installation directory.publicFolder to provide static resources.
Nginx configuration example:
Create a new site configuration file in the Nginx configuration directory (for example,/etc/nginx/conf.d/yourdomain.com.conf),and add the following content:
server {
listen 80;
server_name www.yourdomain.com; # 替换为您的域名
root /www/wwwroot/anqicms.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; # 确保所有请求都经过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 configuration is complete, please check if the syntax of the Nginx configuration file is correct:nginx -t. If there are no errors, reload the Nginx service to make the configuration take effect:systemctl reload nginxorservice nginx reload.
Apache configuration example:
If you choose to use Apache as a web server, please make sure that it is enabledmod_proxyandmod_proxy_httpModule. Then, add the reverse proxy rule in your virtual host configuration file. First, add the virtual host.DocumentRootto AnQiCMS.publicdirectory.
`apache
ServerName www.yourdomain.com # 替换为您的域名
DocumentRoot /www/wwwroot/anqicms.com/public # 替换为您的AnQiCMS public目录
<Directory /www/wwwroot/anqicms.com/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8001/