安企CMS的安装-服务器手动部署 适用场景无面板的 Linux 服务器如 CentOS / Ubuntu适合熟悉命令行操作的用户。通过下载安装包、配置 Nginx 反向代理和 MySQL 数据库的方式完成部署。前置准备一台 Linux 服务器CentOS 7 或 Ubuntu 20.04已安装 Nginx 和 MySQL 5.6.35推荐使用 LNMP 一键安装包一个已解析到服务器的域名已下载 AnQiCMS Linux 安装包安装步骤Step 1下载并解压# 登录服务器sshrootyour-server-ip# 下载安装包以 v3.6.2 为例wgethttps://github.com/fesiong/anqicms/releases/download/v3.6.2/anqicms-linux-v3.6.2.zip# 创建站点目录mkdir-p/data/wwwroot/anqicms# 解压安装包unzipanqicms-linux-v3.6.2.zip-d/data/wwwroot/anqicms# 进入站点目录cd/data/wwwroot/anqicms# 查看文件列表ls-la解压后的目录结构/data/wwwroot/anqicms/ ├── anqicms # 主程序可执行文件 ├── start.sh # 启动脚本 ├── stop.sh # 停止脚本 ├── config.json # 配置文件 ├── public/ # Web 根目录 ├── template/ # 模板目录 └── system/ # 后台管理界面Step 2启动 AnQiCMS# 启动前确保 config.json 中的端口配置正确默认 8001catconfig.json# {server:{site_name:,env:production,port:8001,log_level:release}}# 执行启动脚本./start.sh# 检查是否启动成功ps-ef|grepanqicms# 如果看到 anqicms 进程说明启动成功Step 3配置 Nginx 反向代理创建或编辑 Nginx 站点配置文件vim/etc/nginx/conf.d/anqicms.conf写入以下配置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; } location / { try_files $uri $uri/index.html AnqiCMS; } # 静态资源直接由 Nginx 处理不经过反向代理 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|ico)$ { expires 30d; access_log off; } access_log /var/log/nginx/anqicms-access.log; error_log /var/log/nginx/anqicms-error.log; }注意将server_name和root路径替换为你的实际域名和站点路径。验证配置并重载 Nginx# 测试配置是否正确nginx-t# 重载 Nginx 使配置生效nginx-sreloadStep 4添加计划任务保活为了让 AnQiCMS 在服务器重启后自动运行添加 crontab 计划任务# 编辑 crontabcrontab-e# 添加以下行每分钟检查一次 anqicms 进程*/1 * * * * /data/wwwroot/anqicms/start.sh# 保存并退出vim 中 :wq手动执行一次启动脚本./start.shStep 5配置 HTTPS可选推荐使用 Let’s Encrypt 免费 SSL 证书# 安装 certbot# CentOS:yuminstallcertbot python3-certbot-nginx# Ubuntu:aptinstallcertbot python3-certbot-nginx# 获取并自动配置 SSL 证书certbot--nginx-dwww.anqicms.com-dm.anqicms.com# 按照提示完成验证certbot 会自动修改 Nginx 配置Step 6初始化安装在浏览器中访问http://www.anqicms.com进入初始化安装界面填写数据库信息和管理员账号Apache 反向代理配置可选如果使用 Apache 而非 Nginx配置如下VirtualHost *:80 ServerName www.anqicms.com ServerAlias m.anqicms.com DocumentRoot /data/wwwroot/anqicms/public ProxyPass / http://127.0.0.1:8001/ ProxyPassReverse / http://127.0.0.1:8001/ Directory /data/wwwroot/anqicms/public Options FollowSymLinks AllowOverride All Require all granted /Directory ErrorLog /var/log/apache2/anqicms-error.log CustomLog /var/log/apache2/anqicms-access.log combined /VirtualHost需要启用 Apache 的 proxy 模块a2enmod proxy proxy_http systemctl restart apache2常用管理命令# 启动cd/data/wwwroot/anqicms./start.sh# 停止cd/data/wwwroot/anqicms./stop.sh# 查看运行状态ps-ef|grepanqicms# 查看运行日志tail-f/data/wwwroot/anqicms/running.log# 查看启动检测日志tail-f/data/wwwroot/anqicms/check.log# 修改端口编辑 config.json 后重启vim/data/wwwroot/anqicms/config.json# 修改 port: 8001 为其他端口验证安装# 1. 检查进程是否运行ps-ef|grepanqicms|grep-vgrep# 2. 检查端口是否监听netstat-tlnp|grep8001# 3. 浏览器访问域名应看到网站首页或安装界面# 4. 访问 域名/system/ 进入后台❓ 我安装了 MySQL但不知道 root 密码是什么怎么办如果是通过 LNMP 一键安装包安装的 MySQLroot 密码通常保存在以下位置# LNMP 安装包cat/root/.mysql_root_password# 或cat/usr/local/mysql/root.txt# 宝塔面板安装的 MySQLcat/www/server/mysql/default.pass如果以上都找不到可以绕过 MySQL 认证来重置密码以 Ubuntu 为例# 1. 停止 MySQLsystemctl stop mysql# 2. 以跳过权限检查的方式启动mysqld_safe --skip-grant-tables# 3. 无密码登录 MySQLmysql-uroot# 4. 在 MySQL 命令行中重置密码ALTERUSERrootlocalhostIDENTIFIED BY你的新密码;FLUSH PRIVILEGES;EXIT;# 5. 重启 MySQLsystemctl restart mysql❓ 配置完 Nginx 后访问域名显示的是 Nginx 默认欢迎页而不是安装界面为什么这是新手最常犯的错误。原因通常有以下两个原因一Nginx 的 root 路径指向了默认网站目录# 检查默认网站配置文件中是否还有 server 块ls/etc/nginx/conf.d/default.conf# 如果有暂时将其重命名禁用mv/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak nginx-sreload原因二Nginx 配置中的 root 没有指向 public 子目录# ❌ 错误 root /data/wwwroot/anqicms; # ✅ 正确 root /data/wwwroot/anqicms/public;原因三DNS 未生效刚添加的域名解析可能需要几分钟到几小时才能全球生效。可以用以下命令测试# 直接通过服务器 IP 测试如果 AnQiCMS 监听在 8001 端口curl-Ihttp://127.0.0.1:8001# 如果返回 200 或 302说明 AnQiCMS 正常运行是 Nginx 或 DNS 的问题❓ 我修改了 config.json 中的端口为 8080还需要同步修改哪里修改端口后必须同步修改以下两处位置修改内容Nginx 配置中的proxy_passproxy_pass http://127.0.0.1:8080;而不是 8001重启 AnQiCMS改完 config.json 后必须重启进程才生效如果不修改 Nginx 的proxy_passNginx 仍然会尝试把请求转发到 8001 端口而 AnQiCMS 已经在 8080 端口监听用户就会看到 502 Bad Gateway。