VirtualBox WordPress重定向到端口80 [英] VirtualBox WordPress redirects to port 80

查看:67
本文介绍了VirtualBox WordPress重定向到端口80的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在OSX 10.9.2上运行.我只是在VirtualBox的Lubuntu上设置了LAMP,以便可以通过VirtualBox运行开发服务器.我将/etc/apache2/ports.conf更改为侦听8080,而不是80,并使用以下配置通过NAT设置了VirtualBox端口转发:

I'm running on OSX 10.9.2. I just set up LAMP on Lubuntu in VirtualBox so that I could run a development server through VirtualBox. I changed my /etc/apache2/ports.conf to listen on 8080 instead of 80, and I set up my VirtualBox port forwarding with NAT with the following configuration:


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

通过访问主机(Mac)上的localhost:8080/testwebsite,我可以访问在/var/www/中创建的网站,例如/var/www/testwebsite/.我正在尝试在来宾计算机上安装WordPress网站.我已遵循 Digital Ocean的如何安装WordPress在Ubuntu 12.04 上运行,到目前为止,当我在来宾计算机(Lubuntu)中访问http://localhost:8080/wordpresssite时,它仍然可以工作,但是当我尝试在主机上访问http://localhost:8080/wordpresssite时,它会重定向到http://localhost/wordpresssite,此时可以找不到.如何解决此问题?预先感谢!

I can access websites that I have created in /var/www/ such as /var/www/testwebsite/ by accessing localhost:8080/testwebsite on my host machine (the Mac). I'm trying to install a WordPress site on my guest machine. I have followed Digital Ocean's How To Install WordPress on Ubuntu 12.04 and so far it works when I access http://localhost:8080/wordpresssite inside the guest machine (Lubuntu), but when I try to access http://localhost:8080/wordpresssite on my host machine, it redirects to http://localhost/wordpresssite, when then can't be found. How do I fix this issue? Thanks in advance!

推荐答案

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

I ended up following this guide: http://codex.wordpress.org/Changing_The_Site_URL

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

In my wp-config.php, I added the following two lines

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.我认为这可能是一个缓存问题,因为在隐身状态下它不会重定向.

It's a little hacky, but it works for my own testing purposes. Also, apparently I've been running into an issue where localhost:8080/wordpresssite redirects to localhost/wordpresssite on Chrome. I think that this might be a caching issue, since it doesn't redirect when I'm in incognito.

这篇关于VirtualBox WordPress重定向到端口80的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆