This installation tutorial is suitable forAnqiCMS version 2.x.AnqiCMS 3.x version uses a new installation method:New installation method
AnqiCMS is an enterprise site content management system developed using GoLang. It has simple deployment, secure software, elegant interface, small and fast execution. Websites built with AnqiCMS can prevent many security problems from occurring.
Supported systems
- Supports Windows 7, Windows 8, Windows 10, Windows 11, and Windows server versions. Windows XP not tested
- Supports X86-based Linux versions, such as Ubuntu, Centos, Red Hat, Debian, etc.
AnqiCMS version
You can visit:/anqicmsorhttps://github.com/fesiong/goblogTo get the latest version.
If you have AnqiCMS installed, you can also use the background check and update function to keep your website program as the latest version.
Install AnqiCMS
Installation on pagoda (recommended)
- Create a site
Create a site in the Baota background and fill in your domain name, such aswww.anqicms.com
,m.anqicms.com
.
- Adjust nginx configuration
On the site list, in the corresponding site menu, click Settings, in the settings interface, click the Site Directory tab, and set the Run Directory column to/public
And save.
Switch to the pseudostatic tag and fill in the pseudostatic rules:
location @AnqiCMS {
proxy_pass http://127.0.0.1:8001;
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;
}
Save, then nginx is configured.
If you are using Apache, the step of adding pseudostatic is different. Apache does not need to configure pseudostatic, but needs to add a proxy to the reverse proxy, as shown in the figure:
- Add scheduled tasks
On the Pagoda panel, click the Schedule Task menu to go to the Schedule Task interface and add it separatelystart.shandstop.shcontent into the planned task.
Add a scheduled task that is executed every minute, with the name Start and the content is:
#!/bin/bash
### check and start AnqiCMS
# author fesion
# the bin name is anqicms
BINNAME=anqicms
BINPATH=/www/wwwroot/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
**Notice:
BINPATH=/www/wwwroot/anqicms
The path in it needs to be changed to the actual real path of your site.- If your executable file name is not anqicms, replace it with the corresponding name.
Add another scheduled task that is executed once a month, with the name of Stop and the content is:
#!/bin/bash
### stop anqicms
# author fesion
# the bin name is anqicms
BINNAME=anqicms
BINPATH="$( cd "$( dirname "$0" )" && pwd )"
# check the pid if exists
exists=`ps -ef | grep '\<anqicms\>' |grep -v grep |awk '{printf $2}'`
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"
else
echo "$BINNAME is running"
kill -9 $exists
echo "$BINNAME is stop"
fi
At this point, the site configuration is over.
Click to execute the scheduled task with the name Start, and start will be completed.
Install multiple AnqiCMS on the same server
Often, there is a need to build multiple websites on the same server. To build multiple websites using AnqiCMS, the work required is:
- Copy multiple copies of AnqiCMS's code;
- Edit and change the config.json in the root directory, and change the port port to a new port. For example, 8002 and 8003, each copy of the code needs to use a new port.
- Change the place about port 8001 in nginx pseudo-static configuration and change it to a new port.
- And rename the anqicms file in the directory to a new and different file name, such as the middle letter named as the domain name. If the site you are doing is taobaoke.com, you can name it taobaoke
- Add another start script and stop script to the scheduled task, change the BINPATH path in the start script to a new directory path, BINNAME's anqicms and
grep '\<anqicms\>'
change anqicms in it to taobaoke.
Install on PHPStudy
The same goes for PHPStudy (Xiaopi), software switches to use the PHP + MySQL + Nginx package.
- Create a site
On the PHPStudy software interface, create a site and fill in your domain name, such asdev.anqicms.com
,m.anqicms.com
, remember the site root directory, as mine is:C:/phpstudy_pro/WWW/dev.anqicms.com
, on this basis, add/public
, the root directory becomesC:/phpstudy_pro/WWW/dev.anqicms.com/public
.
Click Confirm to complete the creation of the site.
- Adjust nginx configuration
Switch to the PHPStudy settings menu, select the configuration file label, and then selectvhosts.conf
Tags, finddev.anqicms.com_80
This configuration file (according to the domain name you set in the above step), click Open,location / {
This line (about line 5), replace the code:
location @AnqiCMS {
proxy_pass http://127.0.0.1:8001;
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;
Save, configure nginx and restart nginx.
- Place files
Through the website interface of PHPStudy (Xiaopi) software, click Management to open the website root directory and you will comeC:/phpstudy_pro/WWW/dev.anqicms.com/public
, return to the previous level of the directory and copy the AnqiCMS software file to here:
At this point, the site configuration is over.
Click to execute the scheduled task with the name Start, and start will be completed.
Then double-click anqicms.exe to run.
No window will appear when running, but don't panic. At this time, you open a browser and typehttp://dev.anqicms.com
Visit and you can see the interface.
- quit
There is no exit script on Windows, so Windows' task manager is needed. We right-click on the taskbar and select Task Manager, switch to detailed mode, find the anqicms process in the background process bar, select anqicms, and end the task, and then complete the exit.
Manually install on the server
Let’s take deployment on a Centos server as an example to introduce the installation method.
- Download the source code
Download address:/download
Select the Linux version to download to the server and name it anqicms.linux.tar.gz
Unzip anqicms.linux.tar.gz and enter the directory
tar -xzvf anqicms.linux.tar.gz
cd anqicms
# 查看当前目录
pwd
- Install Nginx and MySQL
If you have installed it, skip it. Recommended usehttps://lnmp.org/
To install, you can save trouble, please refer to the installation methodhttps://lnmp.org/
.
- Configure Nginx site
Generally speaking, you also need to configure nginx proxy to use port 80 or https port. The following is the site and directory/data/wwwroot/anqicms
,domain namewww.anqicms.com
,m.anqicms.com
Configuration as an example:
We need to configure the website's running directory, that is, the nginx root directory, to the public directory under the site directory.
And set the reverse proxy, target URL:http://127.0.0.1:8001
The nginx proxy code is as follows:
location @AnqiCMS {
proxy_pass http://127.0.0.1:8001;
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;
}
Complete nginx configuration:
server
{
listen 80;
server_name www.anqicms.com m.anqicms.com;
root /data/wwwroot/anqicms/public;
location @AnqiCMS {
proxy_pass http://127.0.0.1:8001;
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 access.log;
}
The nginx settings are completed, restart nginx to make the configuration take effect.
- Planned task monitoring operation
In order to keep the website running continuously, after the server restarts, the website will still run. Add a scheduled task script, the execution cycle is executed once a minute, and the content is:
crontab -e
# 在打开的编辑界面,增加一行
*/1 * * * * /data/wwwroot/anqicms/start.sh
# ws 保存并退出。
After adding the scheduled task, execute it again:
./start.sh
At this point, you can open the bound domain name in your browser to access it.
Source code compilation and installation (not recommended)
If you cannot use the version we provide, or you know the golang code very well, and even need to use AnqiCMS to customize some special features, then you can choose to compile and install it through source code to meet your needs.
- The software that AnqiCMS needs to rely on
software | Version |
---|---|
golang | 1.13 (and above) |
mysql | 5.6.35 (and above) |
By default, you are considered to have installed GoLang and MySQL software. If you don't have these two software installed, you can get the installation method through search engines.
- Clone the code
WillAnqiCMS
The code of Clone to any local directory and enter the directory operation
git clone https://github.com/fesiong/goblog.git
# 进入 操作目录
cd goblog
- Compile AnqiCMS source code
For well-known reasons, we need to set up a proxy first and execute this code in the terminal:
go env -w GOPROXY=https://goproxy.cn,direct
Then execute the following code. The compiled code is compiled into an executable file. The test run can be modified while testing.
go mod tidy
go mod vendor
Test run AnqiCMS
go run kandaoni.com/anqicms/main
You can use the above code to test running AnqiCMS to check the correctness of the code. After execution, you can enter the test address in the browser to access:http://127.0.0.1:8001
Compile AnqiCMS under Windows
go build -ldflags '-w -s -H=windowsgui' -o ./anqicms.exe kandaoni.com/anqicms/main
Compile AnqiCMS under MacOS
go build -ldflags '-w -s' -o ./anqicms kandaoni.com/anqicms/main
Compile AnqiCMS under Linux
You just need to execute the make command in the root directory of AnqiCMS
make
It will generate a release directory in the current directory, and prepare template files, etc., and you can directly copy the directory inside to the production environment for use.
Run AnqiCMS
- Windows user running
Please double-click anqicms.exe to run
For the first visit, you need to initialize AnqiCMS first. In the initialization interface, enter MySQL information, and set the administrator account and password, you can access the front and backend of the website normally.
- Linux user running
We have prepared automatic scripts for the production environment, and if you need to start the project, executestart.sh
, if it needs to be stopped, executestop.sh
.
# 启动项目
./start.sh
# 停止项目
./stop.sh
Visit the web page
After running, enter the address in the browser:http://127.0.0.1:8001
Visit the front-end page
Access backend management
passhttp://127.0.0.1:8001/system/
Visit the background page.
If you do not initialize the blog by installing the installation, you may not have set up an administrator account. If you do not have an administrator account, the default administrator account passwords are:
Account: admin
Password: 123456
?Problem feedback
If you encounter a problem, please open an issue on Github.
You can also add my WeChat: websafety
Scan the code to join the golang development learning group
License
The MIT License (MIT)
Copyright (c) 2019-NOW AnQiCMS