后端代码:
perl
cd /opt/lawyer-reception/server
nano server.js
重启nginx
perl
sudo nano /etc/nginx/conf.d/lawyer-reception.conf
sudo nginx -t && sudo systemctl reload nginx
前台:
perl
/opt/lawyer-reception/frontend/
index.html (官网首页)
register.html
login.html
dashboard.html (律师后台)
lawyer.html (动态接待页面)
后端服务状态:
perl
pm2 status
非online查看错误日志:
perl
pm2 logs lawyer-api --lines 30
测试后端接口直接可达:
perl
curl -X POST http://127.0.0.1:3000/api/register -H "Content-Type: application/json" -d '{"username":"test","password":"123456","displayName":"测试"}'
如果返回类似 {"success":true} 的 JSON,说明后端没问题,是 Nginx 代理出错。
如果返回 HTML 或连接拒绝,说明后端没在 3000 端口正常工作,优先修复后端
确认后端文件:
perl
cd /opt/lawyer-reception/server
ls -la
手工启动后端:
perl
node server.js
修改.env
则需重启后端
perl
pm2 restart lawyer-api
pm2 logs lawyer-api --lines 5