As a senior website operation 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 fields of small and medium-sized enterprises and content operations with its lightweight and efficient features of 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.
MacOS system, a brief guide to installing and testing AnQiCMS
MacOS system has become the preferred work platform for many technology 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, you first need to make sure that your system has the necessary runtime environment.This includes two core components: MySQL database and Nginx server.AnQiCMS as a Go language application, needs 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 the task by using the popular package management tool Homebrew on MacOS. You can run it in the terminal.brew install mysqlInstall MySQL, as well asbrew 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 preparing the environment, the next step is to obtain the AnQiCMS package.You can directly go to the official download page of AnQiCMS, find and download the version suitable for MacOS.通常,它会是一个压缩包文件。DocumentsA new directory under the folder, unzip it there. After unzipping, you will see a directory namedanqicms的可执行文件(可能没有")."English.exe后缀,因为是MacOS)。"."English
首次运行与初始化"."English
Installing AnQiCMS is very simple, it does not require a complex installation wizard. All you need to do is go to the directory where AnQiCMS is unzipped and then double-click to run it.anqicms文件即可。EnglishPlease note that on MacOS, the first run may encounter a security prompt. You need to go to 'System Settings' > 'Privacy and Security' to find and allow the application to run.
When AnQiCMS runs successfully, it will start the service on the local8001port. 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.You must always 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 has been successfully initialized and is running.
test single site access
After initialization, you can visit the website through the browserhttp://127.0.0.1:8001to view the front-end page of the website. The back-end 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, etc.
Local multi-site testing (Nginx reverse proxy and Hosts configuration)
If you need to test multiple AnQiCMS sites locally on MacOS without deploying an independent AnQiCMS program for each site, or want to simulate access with real domain names, you will need the cooperation of 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), you will need toportConfiguration item modified to a different port number, for example8001/8002Then run these one by one.anqicmsExecutable file.Configure Nginx reverse proxy.To access these local services through a custom domain, you need to edit the Nginx configuration file (usually in
/usr/local/etc/nginx/nginx.confor/usr/local/etc/nginx/servers/Add a new site for each local site.serverA block that proxies 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 above configuration according to your actual AnQiCMS program path and port number. After modifying the Nginx configuration, remember to restart the Nginx service to take effect.
sudo nginx -s reload).Modify Hosts FileTo allow your MacOS to resolve these local test domains, you need to edit
hostsRun in the terminalsudo 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 through:
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 application namedanqicmsThe process and end it. A more common method is to use the terminallsof -i:{端口号}[for example]lsof -i:8001) to find the PID (Process ID) of the port occupied by AnQiCMS, then usekill -9 {PID}Command to terminate the process. This ensures that the AnQiCMS service is cleanly closed.
You can easily install, test, and manage the AnQiCMS single-site or multi-site environment on MacOS by following these steps.AnQiCMS's lightweight and convenient nature makes local development and testing efficient and pleasant.
Common Questions (FAQ)
Q1:How to solve the problem when running AnQiCMS on MacOS and it prompts 'Port is already in use'?A1:This usually means that the port (default 8001) that AnQiCMS tries to use is occupied by another program. You can run it in the terminal bylsof -i:8001Replace 8001 with the actual conflicting port number to see which program is using the port. After finding the corresponding process ID (PID), usekill -9 PIDCommand to terminate it. If you don't want to close other programs, you can also modify the root directory of AnQiCMS.config.jsonfile, and willportField modification to an unoccupied port number, such as 8003, then re-run AnQiCMS.
Q2: Where is the Nginx configuration file on MacOS? How do you restart the Nginx service?A2:If you 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-enabledDirectory stores configuration files for each site. After modifying the configuration, you need to usesudo nginx -s reloadthe command to restart Nginx service smoothly, so that it loads the new configuration.
Q3:Why can't I access the local AnQiCMS via a custom domain name even though I have configured the Hosts file and Nginx according to the steps?A3:Please carefully check the following points:“
- Is the Hosts file saved correctly?Confirm that you are using
sudoPermission to edit and save/etc/hostsThe file, and the entry format is127.0.0.1 your.domain.com. - Is 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?Make sure to execute after modifying the Nginx configuration
sudo nginx -s reloada command. - 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, the built-in firewall of MacOS or third-party security software may block the communication of Nginx or AnQiCMS.Check the settings to ensure they are not blocked.