Ruby on rails 无法对配置了passenger和apache的rails使用tts
我有一个rails 3.2应用程序,已配置为与phusion passenger和apache一起工作。 正常的请求在我的服务器上正常运行,但是当tts gem试图通过rails应用程序连接到google tts服务器时,我得到以下错误Ruby on rails 无法对配置了passenger和apache的rails使用tts,ruby-on-rails,ruby,apache,httprequest,passenger,Ruby On Rails,Ruby,Apache,Httprequest,Passenger,我有一个rails 3.2应用程序,已配置为与phusion passenger和apache一起工作。 正常的请求在我的服务器上正常运行,但是当tts gem试图通过rails应用程序连接到google tts服务器时,我得到以下错误 SystemExit in DemoController#call exit 及 这是我的演示控制器的相关部分 require 'tts' require "open-uri" require "net/https" require 'json'
SystemExit in DemoController#call
exit
及
这是我的演示控制器的相关部分
require 'tts'
require "open-uri"
require "net/https"
require 'json'
class DemoController < ApplicationController
def call
string1 = "Testing in file one"
string1.to_file "en", "file1.mp3"
end
end
需要“tts”
需要“打开uri”
需要“net/https”
需要“json”
类DemoController<应用程序控制器
def呼叫
string1=“在文件1中进行测试”
string1.to_文件“en”,“file1.mp3”
结束
结束
任何帮助都将不胜感激。
提前感谢在谷歌搜索了一个小时后,终于找到了解决方案。 问题是gem没有获得足够的权限来执行系统命令。这不是乘客阻塞请求的问题。 解决这个问题的一个简单方法是给乘客足够的权限来执行必要的任务。 考虑一个样本:
<VirtualHost *:80>
# Change these 3 lines to suit your project
RailsEnv development
ServerName xyz.abc.com
DocumentRoot /home/user/app/public
<Directory /home/user/app/public>
AllowOverride all
Options -MultiViews
</Directory>
PassengerHighPerformance on
PassengerSpawnMethod direct
</VirtualHost>
你知道以root用户身份运行应用程序是非常危险的,对吗?Passenger竭尽全力阻止您以root身份运行应用程序,但如果您覆盖了所有这些,那么您可能面临的任何安全漏洞都将完全由您自己承担风险。我找不到任何其他可行的解决方案。我所知道的唯一其他解决方案是为rails应用程序中的所有内容授予777权限
<VirtualHost *:80>
# Change these 3 lines to suit your project
RailsEnv development
ServerName xyz.abc.com
DocumentRoot /home/user/app/public
<Directory /home/user/app/public>
AllowOverride all
Options -MultiViews
</Directory>
PassengerHighPerformance on
PassengerSpawnMethod direct
</VirtualHost>
PassengerUser root
PassengerDefaultUser root