As an experienced website operations expert, I fully understand the importance of an efficient and stable content management system (CMS) for a corporate website.AnQiCMS (AnQiCMS) stands out in the field of small and medium-sized enterprises and content operations with its lightweight and efficient features in the Go language.Today, let's delve into how to easily install and test AnQiCMS on our commonly used MacOS system, so that everyone can better understand and use this excellent CMS.
A concise guide to installing and testing AnQiCMS under MacOS
The MacOS system has become the preferred work platform for many tech enthusiasts and developers due to its friendly interface and powerful development environment.If you also want to experience the charm of AnQiCMS on MacOS or perform local development debugging, the following content will provide you with clear guidance.
Preparation: setting up the local environment
Run AnQiCMS on MacOS, first you need to make sure that your system already has the necessary running environment.This mainly includes two core components: MySQL database and Nginx server.AnQiCMS as a Go language application requires MySQL to store its content and configuration data, while Nginx can act as a reverse proxy server to help us better manage and access the AnQiCMS application.
If you have not installed these components yet, you can easily complete it through the popular package management tool Homebrew on MacOS. You can run it in the terminal.brew install mysqlInstall MySQL and as wellbrew install nginxInstall Nginx. After installation, remember to start these services and perform basic configuration, such as setting the root password for MySQL, or starting the Nginx service.
Get the AnQiCMS program
After setting up the environment, the next step is to obtain the AnQiCMS package.You can directly go to the AnQiCMS official website download page and find and download the version suitable for MacOS.It is usually a compressed file package. After the download is complete, choose a local directory you like, such as yourDocumentsCreate a new directory under the folder, unzip it there. After unzipping, you will see a directory namedanqicmsThe executable file (may not exist).exesuffix, as it is MacOS).
First run and initialization
It is very simple to install AnQiCMS, it does not require a complex installation wizard. You just need to enter the directory where AnQiCMS is unpacked, then double-click to run thatanqicmsPlease run the file. Note that on MacOS, you may encounter a security prompt for the first time. You need to go to "System Settings" > "Privacy and Security" to find and allow the app to run.
After AnQiCMS runs successfully, it will be running locally on the8001port, starting the service. At this time, open your browser and visithttp://127.0.0.1:8001. If it is your first visit, AnQiCMS will automatically guide you to the initial installation interface.In this interface, you need to fill in the database connection information as prompted (usually the connection information of the local MySQL, including the database address, port, username and password), and set your AnQiCMS backend administrator account and password, as well as the basic information of the website.Remember the administrator account and password you set, as they will be your credentials for managing the website in the future.After completing these steps, your AnQiCMS website will be successfully initialized and running.
the single site access test
After initialization, you can access it through the browserhttp://127.0.0.1:8001to view the website's front page. The backend management interface is usually locatedhttp://127.0.0.1:8001/system/You can use the administrator account and password you just set to log in and start experiencing the various functions provided by AnQiCMS, such as content publishing, category management, template design, and more.
Local multi-site testing (Nginx reverse proxy and Hosts configuration)
If you need to test multiple AnQiCMS sites locally on MacOS without deploying a separate AnQiCMS program for each site, or want to simulate real domain access, you will need to cooperate with Nginx reverse proxy and the local Hosts file.
Copy AnQiCMS instance and modify the port: To test multiple sites, you can unzip the AnQiCMS program in different directories and in the configuration file of each instance (usually
config.json, in the root directory of the package), setportConfigure the item to a different port number, for example8001/8002Then run these one by one.anqicmsExecutable file.Configure Nginx reverse proxyTo access these local services through a custom domain, you need to edit the Nginx configuration file (usually located in
/usr/local/etc/nginx/nginx.confor/usr/local/etc/nginx/servers/directory). Add one for each local siteserverBlock, proxy different domain names to the corresponding AnQiCMS instance ports. For example:server { listen 80; server_name dev.anqicms1.com; # 你的第一个本地测试域名 root /path/to/anqicms1/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; } } server { listen 80; server_name dev.anqicms2.com; # 你的第二个本地测试域名 root /path/to/anqicms2/public; # 第二个AnQiCMS实例的public目录 location @AnqiCMS { proxy_pass http://127.0.0.1:8002; # 对应第二个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; } }Please modify the configuration according to your actual AnQiCMS program path and port number. After modifying the Nginx configuration, remember to restart the Nginx service to make it effective(
sudo nginx -s reload)Modify the Hosts fileTo allow your MacOS to resolve these local test domains, you need to edit
hostsfile. Run in the terminal.sudo nano /etc/hostsThen add entries similar to the following:127.0.0.1 dev.anqicms1.com 127.0.0.1 dev.anqicms2.comSave and exit the file. Now, you can access your local AnQiCMS multi-site.
http://dev.anqicms1.comandhttp://dev.anqicms2.comTo access your local AnQiCMS multi-site.
Stop AnQiCMS process
On MacOS, AnQiCMS runs as a background process. If you want to stop it, you can find the one named under the "Activity Monitor" application.anqicmsTerminate the process and end it. A more common method is to use the terminallsof -i:{端口号}for examplelsof -i:8001)to find the process ID (PID) occupied by AnQiCMS on the port, and then usekill -9 {PID}Command to terminate the process. This ensures that the AnQiCMS service is cleanly closed.
By following these steps, you can easily install, test, and manage the AnQiCMS single-site or multi-site environment on MacOS.The lightweight and convenient AnQiCMS makes local development and testing efficient and pleasant.
Frequently Asked Questions (FAQ)
Q1: How to deal with the prompt 'Port is already in use' when running AnQiCMS on MacOS?A1: This usually means that the port (default 8001) that AnQiCMS is trying to use has been occupied by another program. You can run it in the terminal bylsof -i:8001(Replace 8001 with the actual conflicting port number) to see which program is using the port. Find the corresponding process ID (PID) after that, and usekill -9 PIDCommand to terminate it. If you don't want to close other programs, you can also modify the AnQiCMS directory under.config.jsonfile, toportModify the field to an unused port number, such as 8003, and then run AnQiCMS again.
Q2: Where is the Nginx configuration file on MacOS? How to restart the Nginx service?A2: If you have installed Nginx via Homebrew, its main configuration file is usually located/usr/local/etc/nginx/nginx.conf. In some configurations, there may also be additionalserversorsites-enabledThe directory stores the configuration files for each site. After modifying the configuration, you need to usesudo nginx -s reloadthe command to smoothly restart the Nginx service and load the new configuration.
Q3: Why did I configure the Hosts file and Nginx according to the steps, but still cannot access the local AnQiCMS through a custom domain?A3: Please check these points carefully:
- Is the Hosts file saved correctly?Confirm that you are using
sudoEdit the permissions and save/etc/hoststhe file, and the entry format is127.0.0.1 your.domain.com. - Is the Nginx configuration correct?Check
server_nameDoes it match your custom domain?rootDoes the path point to the AnQiCMS instance?publicdirectory,proxy_passIs the port consistent with the port where AnQiCMS is actually running. - Has Nginx been restarted?Ensure that the Nginx configuration has been executed after modification.
sudo nginx -s reloadcommand. - Is the AnQiCMS instance running?Confirm that the AnQiCMS program instance you are trying to access is indeed running and listening on the correct port.
- Firewall or security software?Occasionally, MacOS's built-in firewall or third-party security software may block communication with Nginx or AnQiCMS.Check the relevant settings to ensure they are not blocked.