【发布时间】:2010-10-30 12:13:28
【问题描述】:
我有一个带有 Passenger Phusion 的 Ubuntu Hardy 切片,它提供了一个 rails 应用程序。 我也在使用带有thinking_sphinx插件的sphinx全文搜索
我可以从终端运行这个命令:
sudo rake ts:index RAILS_ENV=production
但如果此命令在 capistrano 部署文件中:
运行 "cd #{current_path}; rake thinking_sphinx:index RAILS_ENV=production"
产生以下错误:
- 执行“部署:after_update”
- 正在执行 `thinking_sphinx:index'
- 执行“cd /home/kollar/apps/kinfonet/current; rake thinking_sphinx:index RAILS_ENV=production” 服务器:[“173.45.226.102”] [173.45.226.102] 执行命令 * [err :: 173.45.226.102] 耙子中止! * [err :: 173.45.226.102] 权限被拒绝 - /home/kollar/apps/kinfonet/shared/db/sphinx
假设这是 apache 的权限问题,我关注了有关 slicehost 文档的文章并做了以下操作:
sudo chgrp -R www-data /home/kollar/apps/kinfonet/current
sudo chmod -R 2750 /home/kollar/apps/kinfonet/current
sudo chmod -R 2770 /home/kollar/apps/kinfonet/current/log
sudo chmod -R 2770 /home/kollar/apps/kinfonet/shared
sudo chmod -R 2770 /home/kollar/apps/kinfonet/shared/db
sudo chmod -R 2770 /home/kollar/apps/kinfonet/shared/db/sphinx
sudo chmod -R 2770 /home/kollar/apps/kinfonet/shared/pids
错误仍然存在,现在该网站的访问者无法访问他们位于 /home/kollar/apps/kinfonet/shared/system/avatars 中的个人资料图片
如果我在浏览器上调用图像的路径,则会出现 apache/passenger 禁止错误: 您无权访问此服务器上的 /system/avatars/48/thumb_BR.jpg
有人可以帮助修复权限 - 即撤消我对 www-data 所做的一切并告诉我如何设置适当的权限吗?
【问题讨论】:
-
您需要提供更多信息。哪个用户在远程服务器上运行部署命令?当您运行与该用户相同的 rake 任务 没有 sudo 时会发生什么?还提供来自 Sphinx 数据目录的 ls -l 输出。
标签: ruby-on-rails apache permissions passenger