我最近在名爲「test」的Mac OS上本地創建了一個新的Ruby on Rails 3應用程序。在localhost(Apache,Passenger和VirtualHosts)上發佈新的Ruby on Rails 3應用程序的奇怪問題
由於我使用的Apache2,在私人的/ etc/apache2的/ httpd.conf中我設置了虛擬主機的 「測試」 應用:
<VirtualHost *:443>
ServerName test.pjtmain.localhost:443
DocumentRoot "/Users/<my_user_name>/Sites/test/public"
RackEnv development
<Directory "/Users/<my_user_name>/Sites/test/public">
Order allow,deny
Allow from all
</Directory>
# SSL Configuration
SSLEngine on
...
</VirtualHost>
<VirtualHost *:80>
ServerName test.pjtmain.localhost
DocumentRoot "/Users/<my_user_name>/Sites/test/public"
RackEnv development
<Directory "/Users/<my_user_name>/Sites/test/public">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
當然,我重新啓動的Apache2,而是試圖訪問到http://test.pjtmain.localhost/
我有此錯誤消息:
FIREFOX
Oops! Firefox could not find test.pjtmain.localhost
Suggestions:
*
Search on Google:
...
SAFARI
Safari can’t find the server.
Safari can’t open the page 「http://test.pjtmain.localhost/」 because Safari can’t find the server 「test.pjtmain.localhost」.
我在httpd.conf文件中設置了類似上面的其他RoR3應用程序,並且它們都工作正常。
什麼問題(也許它與apache無關)?
注:
1.
使用 '網絡Uility'
我做了平結果如下:
ping: cannot resolve test.pjtmain.localhost: Unknown host
,我做了一個查找與follonwing結果:
; <<>> DiG 9.6.0-APPLE-P2 <<>> test.pjtmain.localhost +multiline +nocomments +nocmd +noquestion +nostats +search
;; global options: +cmd
<MY_ISP_NAME>.com. 115 IN SOA dns1.<MY_ISP_NAME>.com. dnsmaster.<MY_ISP_NAME>.com. (
2010110500 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
2.
在/私營/ etc/hosts中我有這樣的代碼:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
3.
我使用Phusion客運
4.
由於我沒有什麼不更改爲新的 「測試」 應用程序,我期望看到默認的RoR index.html頁面:
5.
看來,在 '控制檯消息' 有 'dscacheutil -flushcache' 任何警告或錯誤
6.
運行後, 'dscacheutil -statistics' 的反應是:
Overall Statistics:
Average Call Time - 0.000304
Cache Hits - 5311
Cache Misses - 6113
Total External Calls - 5654
Statistics by procedure:
Procedure Cache Hits Cache Misses External Calls
------------------ ---------- ------------ --------------
getpwnam 1496 149 1645
getpwuid 749 11 760
getgrnam 157 28 185
getgrgid 76 7 83
getservbyname 2818 15 26
getservbyport 0 3 3
getprotobyname 1 1 2
getfsent 0 0 2
gethostbyname 14 2816 13
gethostbyaddr 0 116 116
gethostbyname_service 0 0 2817
_flushcache 0 0 2
你可以看看Apache日誌,看看它是否甚至獲取請求? – hornairs 2011-01-07 00:41:45
在/ private/var/log/apache2中:'ssl_request_log'文件爲空; 'error_log'和'access_log'文件報告與'test.pjtmain.localhost'無關的舊值。 – user502052 2011-01-07 00:58:06