我在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
,然后找不到。我该如何解决这个问题?提前致谢!
我最终遵循了这个指南: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
。我认为这可能是一个缓存问题,因为当我隐身时它不会重定向。