我已经将wordpress git存储库克隆到本地MAMP服务器上的htdocs目录。我还创建了数据库并将其导入MAMP服务器。并添加了class SomeComponent extends React.Component {
render() {
return(
<SomeOtherComponent {...this.props} />
)
}
}
的条目,现在看起来像这样:
/etc/hosts
我重新启动了MAMP服务器并在浏览器中查看了该网站,但我收到的只是消息:
有效!
当我这样做时:
127.0.0.1 localhost
127.0.0.1 superselma.dev
我明白了:
未找到
在此服务器上找不到请求的URL / superselma。
我已经配置了wp-config.php文件:
http://localhost:8888/superselma
这是mamp上的vhosts文件的样子:
define('DB_NAME', 'superselma');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'root');
/** MySQL hostname */
define('DB_HOST', 'localhost');
我的apache端口设置为#
# 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>
,文档根目录设置为我的克隆项目目录所在的8888
,所以不确定我做错了什么?
答案 0 :(得分:0)
这就是我设置环境的方法。我假设您希望Wordpress克隆在URL superselma.dev下运行。
我还假设您在htdocs.conf文件中启用了虚拟主机。
删除您刚创建的wp-config.php,只留下他们提供的示例。设置完Web服务器后,第一次调用superselma.dev会弹出一个向导,询问您所需的所有人类可读格式的问题。
专门为您的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>
如果操作正确,您将看到一个wordpress安装向导,它会询问您的数据库详细信息。确保你的MySQL环境事先在xamp中运行,并且你有一个空的Wordpress来做它的事情(创建数据库worpress_sandbox)。
答案 1 :(得分:0)
答案就像在网址superselma.dev:8888
之后添加:8888一样简单,然后就可以了。