AnqiCMS 2.x Version Installation

This installation tutorial is applicable toAnqiCMS 2.x version.AnqiCMS 3.x version uses a new installation method:New installation method

Anqi Content Management System (AnqiCMS) is an enterprise website content management system developed using GoLang. It is easy to deploy, secure software, elegant interface, compact, and fast execution speed. Websites built with AnqiCMS can prevent many security issues from occurring.


Supported Systems

  • Supports Windows 7, Windows 8, Windows 10, Windows 11, and various versions of Windows server. Windows XP has not been tested.
  • Supports Ubuntu, Centos, Red Hat, Debian, and other Linux versions based on X86.


AnqiCMS Version

You can visit:/anqicmsOrhttps://github.com/fesiong/goblogGet the latest version.

If you have installed AnqiCMS, you can also keep your website program up to date by using the background check for updates feature.


Install AnqiCMS


Install on Baota (recommended)

  • Create a site

Create a site on Baota background, and fill in your domain name, such aswww.anqicms.com/m.anqicms.com.

  • Adjust nginx configuration

On the site list, click Settings in the corresponding site menu, click the Site Directory tab in the settings interface, and set the Run Directory field./publicAnd save.


bt-dir


Switch to pseudo-static tags, fill in the pseudo-static 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;
    }


bt-rewrite


Save, then the nginx configuration is complete.

If you are using Apache, this step of adding mod_rewrite is different; Apache does not require configuration of mod_rewrite, but needs to add an agent here in reverse proxy, as shown in the figure:

apache


  • Add a scheduled task

In the Baota panel, click the scheduled task menu, go to the scheduled task interface, and add them separatelystart.shAndstop.shAdd the content to the scheduled task.

Add a scheduled task that runs every minute, named 'Start', with the content:


#!/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


bt-start


**Note:**

  • BINPATH=/www/wwwroot/anqicmsThe path needs to be changed to the actual physical path of your site.
  • If the name of your executable file is not anqicms, it should be replaced with the corresponding name.

Add another task that runs once a month, named 'Stop', with the content:


#!/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


bt-stop


That's it, the site configuration is complete.

Click to execute the task named 'Start' and complete the start.


Install multiple AnqiCMS on the same server.

There is often a need to build multiple websites on the same server, and to build multiple websites using AnqiCMS, the following tasks need to be performed:

  • AnqiCMS's code is copied multiple times;
  • Edit and change the config. in the root directory, change the port to a new port, such as 8002, 8003. Every piece of code needs to use a new port.
  • Change the port 8001 related part in the nginx pseudo-static configuration to a new port.
  • Rename the anqicms file in the directory to a new different filename, such as using the middle letter of the domain name, for example, if the site you built is taobaoke.com, it can be named taobaoke }]
  • Add another startup script and stop script to the scheduled tasks, change the BINPATH path in the startup script to the new directory path, and set the BINNAME to anqicms andgrep '\<anqicms\>'Change anqicms to taobaoke.


Install on PHPStudy (Xiaopi)。

PHPStudy (Little Skin) is the same, the software uses the PHP + MySQL + Nginx package.

  • Create a site

On the PHPStudy (Xiao Pi) software interface, create a site and fill in your domain name, such asdev.anqicms.com/m.anqicms.comRemember the site root directory, such as mine is:C:/phpstudy_pro/WWW/dev.anqicms.comBased on this,/publicThe root directory becomesC:/phpstudy_pro/WWW/dev.anqicms.com/public.


xp-site


Click Confirm to complete the creation of the site.

  • Adjust nginx configuration

Switch to the PHPStudy (Xiao Pi) settings menu, select the configuration file tab, and then selectvhosts.confLabel, finddev.anqicms.com_80This configuration file (based on the domain name you set in the previous step), click to open,location / {This line (about the 5th line), 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;


xp-rewrite


Save, then the nginx is configured and restarted.

  • Place the file

By clicking on the website interface of PHPStudy (Xiaopi) software, go to Management, open the root directory of the website, and you will come toC:/phpstudy_pro/WWW/dev.anqicms.com/publicReturn to the parent directory, copy the files of AnqiCMS software here:

That's it, the site configuration is complete.

Click to execute the task named 'Start' and complete the start.


xp-dir


Then double-click anqicms.exe to run.

The program will not open any windows, but do not be alarmed, at this time, you open a browser, inputhttp://dev.anqicms.comto visit, you can see the interface.

  • exit

There is no exit script on Windows, so we need to use Windows Task Manager. We can exit by right-clicking on the taskbar, selecting Task Manager, switching to the detailed mode, finding the anqicms process in the background process column, selecting anqicms, and ending the task.


xp-stop



Install manually on the server

Taking the deployment on Centos server as an example, we introduce the installation method.

  • Download the source code

Download address:/download

Choose a Linux version to download to the server and name it anqicms.linux.tar.gz

Extract anqicms.linux.tar.gz and enter the directory


tar -xzvf anqicms.linux.tar.gz
cd anqicms
# 查看当前目录
pwd
  • Install Nginx and MySQL

If you have already installed, skip it. It is recommended to usehttps://lnmp.org/to install, which can save you the trouble. See the installation methodhttps://lnmp.org/.

  • Configure the Nginx site.

Generally speaking, it is also necessary to configure nginx proxy to use the 80 port or https port. The following takes the root directory of the site as/data/wwwroot/anqicmsthe domainwww.anqicms.com/m.anqicms.comconfiguration as an example:

We need to configure the website's runtime directory, also known as the nginx root directory, to the public directory under the site directory.

And set up 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;
    }

The 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;
}

nginx is set up, restart nginx to make the configuration take effect.

  • Task scheduler monitoring running

To keep the website running continuously, after the server restarts, the website still runs. Add a scheduled task script, execute the cycle, run once a minute, and the content is:


crontab -e
# 在打开的编辑界面,增加一行
*/1 * * * * /data/wwwroot/anqicms/start.sh
# ws 保存并退出。

After adding the schedule task, execute it by hand once:.


./start.sh

You can now access the bound domain by opening it in the browser.


Source code compilation and installation (not recommended)?

If the version we provide is not usable for you, or you are very familiar with the golang code, and even need to customize some special features with AnqiCMS, then you can choose to install through source code compilation to meet your needs.

  • The software dependencies required for compiling AnqiCMS
SoftwareVersion
golang1.13 (and above)
mysql5.6.35 (and above)

Here it is assumed that you have installed GoLang and MySQL software.If you haven't installed these 2 software packages, you can search for the installation methods on search engines.

  • clone code

toAnqiCMSclone the code to any local directory and enter the directory to operate


git clone https://github.com/fesiong/goblog.git
# 进入 操作目录
cd goblog
  • Compile AnqiCMS source code

Due to the well-known reasons, we first need to set up a proxy, and execute this code in the terminal:


go env -w GOPROXY=https://goproxy.cn,direct

Continue with the following code, compiling the code is to compile it into an executable file, and running tests can be modified while testing.


go mod tidy
go mod vendor

Run test AnqiCMS


go run kandaoni.com/anqicms/main

You can test the execution of AnqiCMS by running the above code and 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 on Windows


go build -ldflags '-w -s -H=windowsgui' -o ./anqicms.exe kandaoni.com/anqicms/main

Compile AnqiCMS on MacOS


go build -ldflags '-w -s' -o ./anqicms kandaoni.com/anqicms/main

Compile AnqiCMS on 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 and so on, which can be directly copied to the production environment for use.


Run AnqiCMS

  • Run for Windows users

Please double-click anqicms.exe to run

First visit, you need to initialize AnqiCMS first. On the initialization interface, enter MySQL information, set the administrator account and password, and then you can normally access the front end and back end of the website.

  • Linux user runs

We have prepared an automatic script for the production environment, to start the project, executestart.shTo stop, executestop.sh.


# 启动项目
./start.sh
# 停止项目
./stop.sh


Visit the web page

After running, enter the address in the browser:http://127.0.0.1:8001Access the front-end page


Access the back-end management

Throughhttp://127.0.0.1:8001/system/Access the back-end page.

If you did not initialize the blog by installation, you may not have set up an admin account. If an admin account has not been set up, the default admin account username and password are:

Account: admin

Password: 123456


?Feedback

If you encounter any issues, please open an issue on Github.

Also, you can add my WeChat: websafety

Scan the code to join the golang development study group


License

The MIT License (MIT)

Copyright (c) 2019-NOW AnQiCMS