【发布时间】:2017-02-08 11:17:39
【问题描述】:
我已将 wordpress git 存储库克隆到本地 MAMP 服务器上的 htdocs 目录。我还创建了数据库并将其导入到 MAMP 服务器。并在/etc/hosts添加了一个条目,现在看起来像这样:
127.0.0.1 localhost
127.0.0.1 superselma.dev
我已经重新启动了 MAMP 服务器并在浏览器中查看了该网站,但我得到的只是消息:
有效!
当我这样做时:
http://localhost:8888/superselma
我明白了:
找不到
在此服务器上找不到请求的 URL /superselma。
我已经配置了 wp-config.php 文件:
define('DB_NAME', 'superselma');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'root');
/** MySQL hostname */
define('DB_HOST', 'localhost');
mamp 上的 vhosts 文件如下所示:
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Applications/MAMP/Library/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/Applications/MAMP/Library/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
# Auto-VirtualHosts with .dev
<VirtualHost *:8888>
ServerName dev
ServerAlias *.dev
VirtualDocumentRoot /Applications/MAMP/htdocs/%-2+
</VirtualHost>
我的 apache 端口设置为 8888,文档根目录设置为 Applications/Mamp/htdocs,我的克隆项目目录在哪里,所以不确定我做错了什么?
【问题讨论】:
-
几个问题: 1. 你的 vhosts 文件是什么样的? 2. 你的 wp-config.php 文件是否已经配置好? 3. 如果 wp-config 文件未配置(您应该只看到示例文件),您是否通过了向导?
-
我将使用 wp-config 文件和 vhosts 文件的示例来编辑问题。没有向导。