我正在嘗試在 Mac 上訪問網站。
如果我使用的http://10.0.1.3/index.html
話,我會得到一個網頁,上面有以下錯誤: Forbidden You don't have permission to access /index.html on this server.
如果我用“localhost”替換 IP,一切都很好。
URIhttp://10.0.1.3/~myusername/
也可以正常運作。
我的作業系統防火牆被停用。沒有 .htaccess 文件,我的 httpd.conf 非常簡單。我一直在查看文檔根權限和所有權(apache 作為 _www/_www 運行,執行權限是在文檔根目錄和根目錄中的 index.html 文件上設置的),但仍然沒有任何樂趣。
這是沒有註解行的 /etc/hosts 內容:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
答案1
如果您已經檢查過檔案權限,那麼您可能會遇到以下指令之一:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
這是來自庫存 OS X Lion httpd.conf。如果您想要存取 /index.html,您似乎需要在某處添加一個允許指令。我假設你的配置中的其他地方是一個允許,如果主機名稱與某個虛擬主機匹配,它就可以工作。您必須發佈您的配置以幫助進一步調試。