[英]Browser redirected to a URL address with a port number from a previous SSH tunnel session
I have set up an apache instance on my ubuntu server in my internal home network. 我在内部家庭网络的ubuntu服务器上设置了一个Apache实例。 Its internal address is
192.168.1.70
. 其内部地址是
192.168.1.70
。 When I visit http://192.168.1.70
I get the standard "It Works!" 当我访问
http://192.168.1.70
我得到标准的“有效!” page of apache. 的页面。
For testing purposes, I have put a php info page ( info.php
) in /var/www
. 为了进行测试,我在
/var/www
放置了一个php信息页面( info.php
)。 When I visit http://192.168.1.70/info.php
I see the standard PHP version + info page. 当我访问
http://192.168.1.70/info.php
我看到标准的PHP版本+信息页面。
I have also set up wordpress under /var/www/wordpress
as well as another info.php
under that same directory. 我还在
/var/www/wordpress
wordpress下设置了wordpress,并在同一目录下设置了另一个info.php
。 When I visit http://192.168.1.70/wordpress/info.php
I am getting the same PHP page as above, which is fine. 当我访问
http://192.168.1.70/wordpress/info.php
我得到的是与上述相同的PHP页面,这很好。
But, when I visit http://192.168.1.70/wordpress
, instead of seeing the wordpress homepage, I see my browser being redirected to this: http://192.168.1.70:9980/wordpress
and showing a "could not connect to 192.168.1.70:9980" error. 但是,当我访问
http://192.168.1.70/wordpress
,没有看到wordpress主页,而是看到我的浏览器被重定向到: http://192.168.1.70:9980/wordpress
: http://192.168.1.70:9980/wordpress
: http://192.168.1.70:9980/wordpress
wordpress并显示“无法连接到192.168.1.70:9980“错误。
Where did this magic port number come from? 这个魔术端口号是从哪里来的? Let me help with some background.
让我提供一些背景知识。 Earlier today I was managing my ubuntu server remotely from work by
ssh
-ing to it using the following command: 今天早些时候,我使用以下命令通过
ssh
-ing远程管理我的ubuntu服务器:
ssh -p ssh_port -L 9980:localhost:80 username@server
in order to be able to test it locally using the http://localhost:9980/wordpress
URL, as the computer I was using wouldn't allow me to forward ports < 1024. 为了能够使用
http://localhost:9980/wordpress
URL在本地进行测试,因为我使用的计算机不允许我转发<1024的端口。
The contents of /etc/apache2/ports.conf
are: /etc/apache2/ports.conf
的内容是:
NameVirtualHost *:80
Listen 80
Why is my browser being redirected to http://192.168.1.70:9980/wordpress
? 为什么我的浏览器被重定向到
http://192.168.1.70:9980/wordpress
? Why is port 9980 being used and where is it coming from? 为什么使用9980端口,它来自何处? Can someone please help out?
有人可以帮忙吗?
Thanks 谢谢
Edit: I have just restarted my router at home but the problem persists. 编辑:我刚刚在家里重启了路由器,但是问题仍然存在。
Edit: The output of curl -I http://192.168.1.70
is: 编辑:
curl -I http://192.168.1.70
的输出是:
HTTP/1.1 200 OK
Date: Thu, 09 Jan 2014 02:06:51 GMT
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Wed, 08 Jan 2014 18:05:15 GMT
ETag: "a39cd-b1-4ef7955bf7f23"
Accept-Ranges: bytes
Content-Length: 177
Vary: Accept-Encoding
Content-Type: text/html
X-Pad: avoid browser bug
Edit: The output of curl -I http://192.168.1.70/wordpress/info.php
is: 编辑:
curl -I http://192.168.1.70/wordpress/info.php
的输出是:
HTTP/1.1 200 OK
Date: Thu, 09 Jan 2014 02:08:04 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.9
Vary: Accept-Encoding
Content-Type: text/html
Edit: The output of curl -I http://192.168.1.70/wordpress/
is: 编辑:
curl -I http://192.168.1.70/wordpress/
的输出是:
HTTP/1.1 301 Moved Permanently
Date: Thu, 09 Jan 2014 18:51:51 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.9
X-Pingback: http://localhost:9980/wordpress/xmlrpc.php
Location: http://192.168.1.70:9980/wordpress/
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
This may sound silly, but are you sure it's not your browser "helping" by substituting an entry from your browsing history? 这听起来很愚蠢,但是您确定不是通过从浏览历史记录中替换一个条目来为浏览器“提供帮助”吗? Chrome is especially aggressive about that.
Chrome对此尤为激进。 Try clearing your browsing history, then trying again.
尝试清除浏览历史记录,然后重试。
The output of curl -I http://192.168.1.70/wordpress/
that you posted shows that Apache is issuing a redirect from there to http://192.168.1.70:9980/wordpress/
. 您发布的
curl -I http://192.168.1.70/wordpress/
的输出显示Apache正在从那里发出重定向到http://192.168.1.70:9980/wordpress/
。 So, there must be a redirect to port 9980 somewhere in the Apache configuration. 因此,必须在Apache配置中的某处重定向到端口9980。 Try running
尝试跑步
grep -r 9980 /etc/apache2
Or, enable mod_info if you haven't already, and restart Apache. 或者,如果尚未启用,请启用mod_info,然后重新启动Apache。 Then go to
http://192.168.1.70/server-info
, and search the page there for 9980. 然后转到
http://192.168.1.70/server-info
,并在该页面上搜索9980。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.