2010年4月4日 星期日

架端web server不能連結至localhost的問題

之前在windows vista上架了一個Apache2.2 http server.
剛架設完後, 當然是很興奮地開啟 http://localhost
來測試一下有沒有出現"It works!"的畫面呀

因為再之前也有架過, 即使在httpd.conf設置後路徑前, 大概至少也看得到it works吧
但我錯了, 事情絕非單純

我開始http://localhost後
IE竟然是顯示404 page not found的頁面
這代表連不到這一頁.


於是便進行了以下測試

  1. 確認Apache monitor有否正常啟動apache server, 亮綠燈 (綠燈呀! 但如果是紅燈但restart後也一直不能正常運作, 可能就要重灌一次apache了, 因為可能灌的時候某些程序出錯了)
  2. 檢查Apache目錄裏htdocs裏是否有index.html (有的, 所以應該是路徑設定有問題)
  3. 再檢查conf裏的httpd.conf,檢查一下各種Directory跟root的路徑有沒有跟真實檔案位置不一樣,這有可能是因為在案裝過程中打錯了路徑或甚麼的(都正確呀,見鬼了@@)
  4. 然後再檢查防火牆跟防毒的設定,確定沒有因為中毒或奇怪地被設定把自己的IP位址給封鎖掉...orz(都好好的呀...)

真是百思不得其解,但後來發生
我打自己的IP(http://140.xxx.xxx.xxx)卻是成功的出現It works!
所以如果跟我遇到同樣的情況,上面檢查的第1,2,3點,應該都不用進行了
基本上應該是localhost這個遮罩沒有對應到本機的IP

後來我去請教高手
高手請我輸入 http://127.0.0.1/ 試試看
結果真的成功,証明應該是跟Apache的設定沒關係
然後高手判斷這應該是localhost沒對應到本機IP的問題

他告訴我開啟
windows/system32/drivers/etc/hosts 這個檔案
然後加上一行
127.0.0.1 localhost
意即把IP對應到後面的host name

儲存後我再開啟 http://localhost/

It works了耶!! 太感動了QQ
雖然我也不知道為甚麼我電腦原本的設定沒有把127.0.01跟localhost對應起來
不過以後再遇到這種不能開localhost的情況, 大概就可以試這些方法吧.

沒有留言:

張貼留言

Powered By Blogger

Label Cloud

2009 (1) 不能連localhost (1) 內嵌音訊 (1) 求職 (1) 面試 (1) 音樂 (1) 動畫師 (1) 帳號管理 (1) 排程 (1) 畢展 (1) 創意市集 (1) 惡意程式 (1) 電腦動畫 (1) 權限管理 (1) adobe (1) android (4) animation (1) animator (1) apache (3) art (5) art taipei 2008 (1) audio (2) bbs (1) birthday (1) black and white (1) browser (2) career (2) certification (1) cgw (1) cinematography (1) code (3) Collie (1) color (2) command (16) competition (1) computer science (3) connection (1) cover (1) crafyJS (1) creative (1) CSS (1) DBN (2) design (7) developer (1) display (1) drawing (1) eclipse (3) embed (1) engine (1) EntityJS (1) exception (1) exhibition (1) flower (1) frame (1) freebsd (11) french (1) friends (3) function (1) game (1) google (2) graphic (3) html (2) HTML5 (1) https (1) illustrator (1) image processing (1) interactive storytelling (1) internet (3) interview (1) introduce (1) ip (1) japan (1) java (4) javascript (3) JIT (1) jmonkey (1) job (1) jquery (1) LAMP (1) LimeJS (1) linux (8) liquid galaxy (1) ListView (1) localhost (1) log (1) mail (1) marquee (1) midi (1) mime-type (1) mis (1) MIT (2) mo-cap (1) mobile (1) Modernizr (1) motion capture (1) movie (1) music (3) narrative (2) NCCU (3) news (1) note (10) originality (1) otaku (1) painting (4) performance (1) photography (2) photoshop (7) php (1) player modelling (1) poster (1) postfix (1) programming (5) QuarkJS (1) resource (1) schema (1) scroll (1) self aware (1) semantic (1) server (1) share (1) sketch (2) software (4) solve (2) Sonivox (1) speaking (1) ssl (1) SSLPeerUnverifiedException (1) streaming (1) Subversion (1) sunspider (1) SVN (3) svn server (1) system (1) taipei (1) test (1) tfam (1) tool (1) TortoiseSVN (1) tutor (1) ubuntu (3) update (1) uri (1) video (1) vim (1) w3c (1) wap wcss css css2.0 (1) web (8) WebGL (1) webkit (2) well-form (1) wiimote (1) wiiusej (1) workshop (1) xhtml (1) xml (2)