【问题标题】:Permission error ruby on rails passenger铁路乘客上的权限错误红宝石
【发布时间】:2011-09-01 22:02:28
【问题描述】:

我可以通过执行 chmod -R 777 current(以 root 身份)来修复以下错误。但显然这不是解决问题的方法。当前文件夹归用户 cmuench:cmuench 所有。 Apache 用户和组是 www-data

ActionView::Template::Error (Permission denied - /var/www/sites/blastoserver.com/current/public/stylesheets/.permissions_check.68324750.30686.12319):
    5:  <script type="text/javascript">
    6:  function IS(){}
    7:  </script>
    8:   <%= stylesheet_link_tag ['autocomplete.css', 'datepicker.css', 'web.css', 'common.css', 'home.css', 'course.css', 'admin.css'], :cache => true %>
    9:   <%= stylesheet_link_tag [@current_client.name.downcase + '/' + @current_client.name.downcase + '.css'], :cache => false %>
    10:   <%= javascript_include_tag ['jquery.js', 'class.js', 'jquery.extensions.js','nested_form.js','jquery.tablednd.js','jquery.autocomplete.js', 'date.js', 'datepicker.js', 'rails.js', 'common.js', 'navigation.js', 'patient_autocomplete.js', 'courses/course_request.js', 'course_steps/sort_course_steps.js', 'course_steps/next_step.js', 'enrollments/complete_course.js', 'flowplayer/flowplayer.js', 'flowplayer/playlist.js', 'course_steps/video.js', 'course_steps/presentation.js', 'highcharts.js', 'reports/course_assignment.js', 'reports/courses_allocated.js', 'reports/pie_chart.js'], :cache => true %>
    11:   <%= csrf_meta_tag %>
  app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb___225745557_81615570__517096065'

【问题讨论】:

    标签: ruby-on-rails


    【解决方案1】:

    引用自passenger user guide(apache版本,但nginx应该是一样的):

    Phusion Passenger 将默认以所有者身份运行 Web 应用程序 config/environment.rb(用于 Rails 应用程序)或 config.ru(用于 机架应用程序)

    您可以通过在全局配置文件、虚拟主机、&lt;Directory&gt; 块或 &lt;Location&gt; 块中设置 PassengerUser 指令来覆盖它。

    为了扩大一点,我只会做一个chown -R cmuench:cmuench *,这应该足够了。仔细检查public/stylesheets 文件夹的权限,因为看起来错误来自这里。

    希望这会有所帮助。

    【讨论】:

    • Web 服务器无法写入样式表和 javascript 目录。我不得不 chmod 777 那些文件夹。这是最好的方法吗?
    • @Chris 并非如此,如果您这样做,系统的任何用户都可以删除这些目录,或者更糟的是,向您的用户提供任何 javascript。谁拥有config/environment.rbconfig.ru
    • 如果您在服务器上执行ps aux | grep /var/www/sites/blastoserver.com/current,您应该能够知道谁在运行您的服务器进程(对我来说它在最左边的列中)。
    • 看起来没有人... cmuench 1138 0.0 0.1 3376 752 pts/0 S+ 12:00 0:00 grep --color=auto /var/www/sites/blastoserver.com/current 没有人 30686 0.1 8.1 55800 41724 ? Sl 09:09 0:19 机架:/var/www/sites/blastoserver.com/current
    • 检查config.ru文件的权限。如果它归cmuench 所有,您可以尝试像这样在您的 apache conf 中强制用户:PassengerUser cmuench
    猜你喜欢
    • 2010-09-09
    • 2011-04-15
    • 2011-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-07
    • 1970-01-01
    相关资源
    最近更新 更多