【发布时间】:2018-11-28 13:07:53
【问题描述】:
我首先关注的是优秀的教程here,然后是here。我认为我成功完成了大部分步骤,因为在将浏览器指向http://localhost 时,我得到了 Apache “它可以工作”。
我按照教程中的建议对文件 /private/etc/apache2/httpd.conf 和 /private/etc/apache2/extra/httpd-vhosts.conf 进行了修改(基本上是告诉 Apache 使用 libphp7.so 而不是拒绝访问文件系统)。
我的httpd-vhosts.conf 看起来像这样:
<Directory "/www">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/www/sites/%1/wwwroot"
ServerName sites.test
ServerAlias *.test
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/www/sites/%-7+/wwwroot"
ServerName xip
ServerAlias *.xip.io
UseCanonicalName Off
</Virtualhost>
我在/ 级别的顶部有一个www 目录:
/www
├── home
└── sites
├── client1
│ ├── assets
│ └── wwwroot
│ └── index.html
├── wordpress
当我在浏览器地址栏中输入client1.test时,它会正确显示index.html的内容。
所以下一步是在sites 中创建一个子目录wordpress,然后将最新的wp 版本下载并解压到该目录中。
在2nd tutorial 中,它说“此时您应该可以在浏览器中点击 wordpress.test 并开始 WordPress 安装过程。”
这对我不起作用:我收到“404 Not Found”消息。我的权限如下所示:
drwxr-xrwx 5 root wheel 160 Jun 19 12:39 client1
drwxrwxrwx 23 _www wheel 736 Jun 19 15:34 wordpress
我注意到与client1 子目录不同,wordpress 不包含wwwroot 子目录。但我想这在这里不重要吗?输入wordpress.test 时,我期待一些安装步骤开始。
有人知道我收到 404 消息的可能原因吗?我在 High Sierra 10.13.5。
【问题讨论】:
-
您是否尝试将 wordpress 文件移动到 wordpress/wwwroot 中?按照您设置配置的方式,它需要具有这种结构。
-
@Devon 是的,我做到了,而不是 404 我得到了
Error establishing database connection。澄清一下,在我的wpconfig.php文件中,我有一行define('DB_NAME', 'wordpress');并且我之前已经在 mysql 中创建了这个数据库(但没有明确地为其分配用户)。尽管如此,还是出现了建立数据库连接错误。
标签: php wordpress apache macos-high-sierra