You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

不使用MAMP在Mac安装WordPress后站点无法访问如何解决?

排查步骤

1. 修正hosts配置

你当前把127.0.0.1 localhost行注释了,这是访问127.0.0.1异常的直接原因之一,先取消注释,同时补充ipv6下的test.com解析:

127.0.0.1  localhost
127.0.0.1  test.com
255.255.255.255 broadcasthost
::1        localhost
::1        test.com

2. 校验httpd.conf基础配置

检查以下配置项是否取消注释(行首没有#):

  • 虚拟主机加载配置:Include etc/apache2/extra/httpd-vhosts.conf
  • PHP解析模块:对应你安装的PHP版本的LoadModule php_module相关行
  • Rewrite模块:LoadModule rewrite_module libexec/apache2/mod_rewrite.so

同时补全你httpd.conf里的<Directory "/Users/amir/Sites">块权限配置,确保包含以下内容:

<Directory "/Users/amir/Sites">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>

3. 修复目录权限

给Sites目录及子目录授予Apache访问权限,执行终端命令:

sudo chmod -R 755 /Users/amir/Sites
sudo chown -R $(whoami):_www /Users/amir/Sites

4. 校验Apache配置语法并重启服务

先执行语法校验命令,排查配置拼写错误:

sudo apachectl configtest

如果返回Syntax OK,再执行重启命令生效配置:

sudo apachectl restart

5. 验证解析是否生效

终端执行ping test.com,如果返回的IP是127.0.0.1说明解析正常,此时再通过浏览器访问test.com即可。如果仍有异常,查看Apache错误日志定位具体问题,日志路径为/private/var/log/apache2/error_log。

内容的提问来源于stack exchange,提问作者Amir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 22:54:07