正在本地将 wordpress 安装到 VM /etc/wordpress/config-localhost.php 文件

Installing wordpress to VM locally /etc/wordpress/config-localhost.php file

所以我在 KVM/Qemu 中的 https://ubuntu.com/tutorials/install-and-configure-wordpress 之后在本地安装 wordpress,当我进入第 5 阶段“从浏览器配置 wordpress”时,您设置了站点标题用户名和密码,我收到错误消息...

找不到 /etc/wordpress/config-192.168.122.54.php

但我知道文件实际上被命名为...

/etc/wordpress/config-localhost.php

因此,我将文件 config-localhost.php 复制到同一目录中的 config-192.168.122.54.php,然后我将转到我希望登陆的页面,配置 wordpress.

我的问题是,我应该知道 IP 会因 DHCP 而改变,还是有更简单的解决方案。我的 VM 网络接口是“虚拟网络 'default': NAT” 如果这很重要?

我知道这是一个 hack,可能会崩溃,但有没有人知道正确的解决方案,为什么它期望我从 'localhost' URI 连接并且不允许我远程连接到 VM。为什么要从 URL 中获取地址来搜索服务器上的文件??

您可以通过创建符号 link :

来省去很多麻烦
sudo ln -s /etc/wordpress/config-localhost.php /etc/wordpress/config-default.php

如果 WordPress 找不到 IP 或基于域的 .php 文件,它将始终使用 config-default.php 文件。