apache2中的乘客独立运行失败

时间:2013-04-16 18:27:53

标签: ruby-on-rails passenger

完成新的rails&乘客。 我在Linux Mint上运行乘客3.0.19。我的应用程序与WEBrick(rails服务器)和独立乘客运行良好。当我尝试使用mod_passenger时,我得到“致命:用户对等身份验证失败”me_user“(PG ::错误)”:

#Phusion Passenger config info
LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.9.1/gems/passenger-3.0.19
PassengerRuby /usr/bin/ruby1.9.1

#Suppose you have a Rails application in /somewhere. Add a virtual host to your
#Apache configuration file and set its DocumentRoot to /somewhere/public:

<VirtualHost *:80>
  ServerName localhost
  # !!! Be sure to point DocumentRoot to 'public'!
  DocumentRoot /var/www/myapp/public
  <Directory /var/www/myapp/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
  </Directory>
</VirtualHost>

我应该注意:db帐户通过命令行工作,并在database.yml中配置。我已经看到ppl表明这是pg_hba.conf的一个问题...但如果这是我的问题,那么应用程序将无法独立运行......但确实如此。 提前致谢。

2 个答案:

答案 0 :(得分:0)

在没有看到你的pg_hba.conf的情况下,我可以通过自己的有趣体验来猜测Postgres与mod_rails一起正常工作。确保你有:

host: localhost
数据库中的

。这将影响Rails尝试连接数据库的方式。

另外,请确保在使用psql客户端进行测试时,您可以在模拟运行mod_rails的用户时执行此操作。例如,如果此用户名为“passenger”:

sudo -u passenger psql -h localhost -U <db_user> -d <db name>

如果这不起作用,请发布适当的编辑后的database.yml和pg_hba.conf,我可以看一下。

答案 1 :(得分:0)

database.yml(注意:测试和开发的定义与生产完全相同)

  

生产:

     

adapter:postgresql

     

编码:unicode

     

数据库:mydb

     

pool:5

     

用户名:myuser

     

密码:pwd

的pg_hba.conf:

  

#Unix域名套接字的数据库管理登录   本地所有postgres同行

     

#“local”仅适用于Unix域套接字连接

     

本地所有同行

     

#IPv4本地连接:

     

主持所有127.0.0.1/32 md5

     

#IPv6本地连接:

     

主持所有:: 1/128 md5

感谢mikeryz!