迁移至DigitalOcean后WordPress卡在加载齿轮,无法访问WP-ADMIN
WordPress迁移DigitalOcean后加载异常&wp-admin 404问题排查方案
开启Apache重写模块
WordPress固定链接依赖mod_rewrite模块,执行以下命令开启并重启服务:sudo a2enmod rewrite sudo systemctl restart apache2修复.htaccess文件
确保网站根目录存在正确的WordPress规则文件,若缺失则新建.htaccess并写入以下内容:BEGIN WordPressreturn (<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> )END WordPress之后设置正确权限:
sudo chown www-data:www-data /var/www/html/.htaccess sudo chmod 644 /var/www/html/.htaccess修正目录/文件权限
确保Apache进程拥有文件访问权限:sudo find /var/www/html -type d -exec chmod 755 {} \; sudo find /var/www/html -type f -exec chmod 644 {} \; sudo chown -R www-data:www-data /var/www/html调整Apache站点配置
编辑你的Apache站点配置文件(通常位于/etc/apache2/sites-available/下,如000-default.conf或域名对应配置文件),在<Directory /var/www/html>块中设置允许.htoverride生效:<Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory>修改后重启Apache:
sudo systemctl restart apache2核对数据库配置
打开wp-config.php,再次确认DB_NAME、DB_USER、DB_PASSWORD、DB_HOST与DigitalOcean上的数据库信息完全匹配,无拼写错误。检查PHP必要扩展
确保WordPress依赖的PHP扩展已安装,执行php -m查看扩展列表,若缺失mysqli、curl、gd等,执行以下命令安装:sudo apt install php-mysqli php-curl php-gd sudo systemctl restart apache2清除浏览器缓存
使用无痕模式访问网站,避免本地缓存导致的加载异常。
内容的提问来源于stack exchange,提问作者kaosmagick
相关产品推荐
相关产品推荐

