近日,在Apache2環境下部署Rails3應用時碰到此錯誤:
Permission denied: [某路徑]/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
此時,在瀏覽器中不管是訪問Rails3應用的根目錄還是次級目錄都會得到“403 - Forbidden”錯誤。查看apache2的error.log文件時會發現類似上面的信息。含具體路徑的錯誤信息爲:
Permission denied: /home/ubuntu/sites/myapp/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
此時,只需修改一下目錄屬性即可解決問題,即:
chmod +x -R /home/ubuntu/sites/myapp