景安虚拟主机网站搬家错误_原因与解决
网站搬家错误时分清是所有页面还是特定页面。所有页面报错是服务器或配置问题,特定页面报错是程序或文件问题。特定 URL 404检查文件是否存在、伪静态规则是否正确;特定页面500检查该页面对应的 PHP 文件代码。
4xx 错误排查:404检查文件是否存在、URL 是否正确、伪静态规则是否匹配;403检查文件权限(644)、目录权限(755)、是否有 deny 规则、目录是否有 index 文件;400检查请求格式(URL 编码、Cookie 大小、Host 头);401检查认证配置(.htpasswd、后台登录)。
参考(网站错误排查命令): ``` # HTTP状态码 curl -I http://域名 curl -I https://域名 curl -I -x 127.0.0.1:80 http://域名 # 源站测试
# 详细输出 curl -v http://域名/页面 2>&1 | head -50
# Nginx日志 tail -50 /var/log/nginx/error.log tail -100 /var/log/nginx/access.log | grep 404
# Apache日志 tail -50 /var/log/httpd/error_log tail -50 /var/log/apache2/error.log
# PHP错误日志 tail -50 /www/wwwroot/域名/error.log
# 资源检查 free -m && df -h && uptime
# 端口和服务 netstat -tlnp | grep -E ":80|:443|:9000" systemctl status nginx php-fpm mysqld ```
排查完用 curl -I 检测确认。修复后 curl -I 返回200,浏览器无痕模式访问正常,所有资源(CSS/JS/图片)都加载成功。如果是 CDN 环境,刷新 CDN 缓存后再测。记录错误原因和修复方法,方便下次快速处理。
Nginx 错误速查:404 log 里有 "file not found";403 log 里有 "directory index forbidden"或"access forbidden by rule";502 log 里有 "connect() failed"或"upstream prematurely closed";504 log 里有 "upstream timed out"。根据日志关键字直接定位。

更新时间:2026-08-26 13:32:20