繁体   English   中英

浏览器已重定向至带有来自先前SSH隧道会话的端口号的URL地址

[英]Browser redirected to a URL address with a port number from a previous SSH tunnel session

我在内部家庭网络的ubuntu服务器上设置了一个Apache实例。 其内部地址是192.168.1.70 当我访问http://192.168.1.70我得到标准的“有效!” 的页面。

为了进行测试,我在/var/www放置了一个php信息页面( info.php )。 当我访问http://192.168.1.70/info.php我看到标准的PHP版本+信息页面。

我还在/var/www/wordpress wordpress下设置了wordpress,并在同一目录下设置了另一个info.php 当我访问http://192.168.1.70/wordpress/info.php我得到的是与上述相同的PHP页面,这很好。

但是,当我访问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“错误。

这个魔术端口号是从哪里来的? 让我提供一些背景知识。 今天早些时候,我使用以下命令通过ssh -ing远程管理我的ubuntu服务器:

ssh -p ssh_port -L 9980:localhost:80 username@server

为了能够使用http://localhost:9980/wordpress URL在本地进行测试,因为我使用的计算机不允许我转发<1024的端口。

/etc/apache2/ports.conf的内容是:

NameVirtualHost *:80
Listen 80

为什么我的浏览器被重定向到http://192.168.1.70:9980/wordpress 为什么使用9980端口,它来自何处? 有人可以帮忙吗?

谢谢

编辑:我刚刚在家里重启了路由器,但是问题仍然存在。

编辑: 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

编辑: 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

编辑: 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

这听起来很愚蠢,但是您确定不是通过从浏览历史记录中替换一个条目来为浏览器“提供帮助”吗? Chrome对此尤为激进。 尝试清除浏览历史记录,然后重试。

您发布的curl -I http://192.168.1.70/wordpress/的输出显示Apache正在从那里发出重定向到http://192.168.1.70:9980/wordpress/ 因此,必须在Apache配置中的某处重定向到端口9980。 尝试跑步

grep -r 9980 /etc/apache2

或者,如果尚未启用,请启用mod_info,然后重新启动Apache。 然后转到http://192.168.1.70/server-info ,并在该页面上搜索9980。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM