VirtualBox WordPress重定向到端口80

问题描述 投票:0回答:2

我在OSX 10.9.2上运行。我只是在VirtualBox中设置了Lubuntu上的LAMP,这样我就可以通过VirtualBox运行开发服务器了。我改变了我的/etc/apache2/ports.conf来听8080而不是80,我使用以下配置设置我的VirtualBox端口转发NAT:

+--------+----------+---------+-----------+----------+------------+
| Name   | Protocol | Host IP | Host Port | Guest IP | Guest Port |
+--------+----------+---------+-----------+----------+------------+
| Apache | TCP      |         | 8080      |          | 8080       |
+--------+----------+---------+-----------+----------+------------+

我可以通过在我的主机(Mac)上访问/var/www/来访问我在/var/www/testwebsite/创建的网站,例如localhost:8080/testwebsite。我正在尝试在我的客户机上安装WordPress网站。我已经关注了Digital Ocean's How To Install WordPress on Ubuntu 12.04,到目前为止,当我在客机(Lubuntu)中访问http://localhost:8080/wordpresssite时,它可以工作,但是当我尝试在我的主机上访问http://localhost:8080/wordpresssite时,它会重定向到http://localhost/wordpresssite,然后找不到。我该如何解决这个问题?提前致谢!

wordpress apache ubuntu virtualbox portforwarding
2个回答
2
投票

我最终遵循了这个指南:http://codex.wordpress.org/Changing_The_Site_URL

在我的wp-config.php中,我添加了以下两行

define('WP_HOME', '<host ip address here>:8080/wordpresssite');
define('WP_SITEURL','<host ip address here>:8080/wordpresssite');

它有点hacky,但它适用于我自己的测试目的。此外,显然我遇到了一个问题,localhost:8080/wordpresssite重定向到Chrome上的localhost/wordpresssite。我认为这可能是一个缓存问题,因为当我隐身时它不会重定向。


0
投票

访问您的数据库并单击选项表。

将网址更改为:http://10.165.12.167:8080/wp/

8080是你的Apache端口。

清除浏览器的缓存,然后重试。

© www.soinside.com 2019 - 2024. All rights reserved.