[英]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.