【问题标题】:Setting up cloned wordpress repository on mamp在 mamp 上设置克隆的 wordpress 存储库
【发布时间】: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 文件的示例来编辑问题。没有向导。

标签: wordpress mamp


【解决方案1】:

这就是我设置环境的方式。我假设您希望 Wordpress 克隆在 URL superselma.dev 下运行。

我还假设您在 htdocs.conf 文件中启用了虚拟主机。

  1. 删除您刚刚创建的 wp-config.php,只留下他们提供的示例。一旦你设置好你的网络服务器,你对 superselma.dev 的第一次调用会弹出一个向导,它会以人类可读的格式询问你所有需要的问题。

  2. 专门为您的 wordpress 网站配置虚拟主机。

    <VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "Insert path to Wordpress root here. " ServerName superselma.dev
    ServerAlias superselma.dev ErrorLog "logs/dummy-host.example.com-error_log" CustomLog "logs/dummy-host.example.com-access_log" common </VirtualHost>

  3. 重新启动您的 apache 服务。
  4. 在浏览器中转到http://superselma.dev

如果操作正确,您将看到一个 wordpress 安装向导,它会询问您的数据库详细信息。确保您的 MySQL 环境事先在 xamp 中运行,并且您有一个空的 Wordpress 可以执行其操作(创建数据库 worpress_sandbox)。

【讨论】:

  • 我已经尝试过你的建议,但是在重新启动 apache 服务器时出现错误:Apache couldn't be started. Please check your MAMP installation and configuration. 我还没有在 htdocs.conf 文件中做任何事情,不确定我需要在那里做什么?
【解决方案2】:

答案很简单,只需在 url superselma.dev:8888 后添加 :8888 即可。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-07
    • 1970-01-01
    • 2021-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-19
    相关资源
    最近更新 更多