我想在Ubuntu VPS服务器上安装rails 3.0.10。 我使用的是Postgres 9.0.4,Apache和乘客。 当我运行我的服务器时,我得到这个错误:
PGError无法连接到服务器:没有这样的文件或目录服务器是否在本地运行,并接受在Unix域套接字“/var/run/postgresql/.s.PGSQL.5432”的连接?
当然,postgres服务器运行,如果我做“轨道服务器”应用程序与webbrick很好。
在安装过程中,我以root用户身份安装了Postgres和Apache,而使用rvm作为另一个用户安装了ruby和rails。 那可以吗?
按照linux用户的说法,安装生产服务器的正确方法是什么? 安装一切作为根或创build一个部署者帐户和安装postgres,Apache和乘客与sudo或甚至没有sudo?
有什么build议么? 生产服务器设置/ conf上没有太多好的教程。 知道吗?
BR
检查你的config / database.yml,开发和生产环境可能有不同的数据库设置。
请记住,要在生产环境(RailsEnv)中创build数据库,或者只需将开发部分下的凭据复制到config / database.yml中的生产部分
以root身份安装PG&Apache没有错,这是保护这些程序的正确方法。
RoR和rvm可以作为非root用户安装,为Apache和乘客创build另一个用户,使用“sudo”启动Apache。
确保您为Apache设置的用户有权访问日志和上传目录。
我设置postgres日志来login信息,当我浏览页面时什么都看不到。 当在PGAdmin中玩耍时,我在日志中看到东西。 我意识到httpd是以root身份运行的,但是postgres是以用户postgres的身份运行的。 Rails作为仅属于组rutger的用户rutger被安装。
netstat -an | grep LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:34533 0.0.0.0:* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 :::5432 :::* LISTEN unix 2 [ ACC ] STREAM LISTENING 239555 /tmp/.s.PGSQL.5432 unix 2 [ ACC ] STREAM LISTENING 6067 /tmp/passenger.1.0.863/generation-0/spawn-server/socket.876.74943570 unix 2 [ ACC ] STREAM LISTENING 6079 /tmp/passenger.1.0.863/generation-0/backends/ruby.<Rutger edited: long key> unix 2 [ ACC ] STREAM LISTENING 6002 /tmp/passenger.1.0.863/generation-0/socket unix 2 [ ACC ] STREAM LISTENING 6006 /tmp/passenger.1.0.863/generation-0/spawn-server/socket.874.163492224 unix 2 [ ACC ] STREAM LISTENING 6034 /tmp/passenger.1.0.863/generation-0/logging.socket unix 2 [ ACC ] STREAM LISTENING 5164 /var/run/dbus/system_bus_socket unix 2 [ ACC ] STREAM LISTENING 5934 /var/run/apache2/cgisock.863 unix 2 [ ACC ] STREAM LISTENING 3960 @/com/ubuntu/upstart >ps -Af|grep postgres postgres 4946 1 0 16:11 pts/0 00:00:00 /opt/postgres/9.0/bin/postgres -D /opt/postgres/9.0/data postgres 4947 4946 0 16:11 ? 00:00:00 postgres: logger process postgres 4949 4946 0 16:11 ? 00:00:00 postgres: writer process postgres 4950 4946 0 16:11 ? 00:00:00 postgres: wal writer process postgres 4951 4946 0 16:11 ? 00:00:00 postgres: autovacuum launcher process postgres 4952 4946 0 16:11 ? 00:00:00 postgres: stats collector process postgres 5012 4946 0 16:13 ? 00:00:00 postgres: postgres postgres 127.0.0.1(58641) idle postgres 5013 4946 0 16:14 ? 00:00:00 postgres: postgres rktest_production 127.0.0.1(58642) idle postgres 5023 4946 0 16:14 ? 00:00:00 postgres: postgres rktest_production 127.0.0.1(58643) idle postgres 5038 4946 0 16:15 ? 00:00:00 postgres: postgres rktest_production 127.0.0.1(58644) idle root 5274 31100 0 16:22 pts/0 00:00:00 grep --color=auto postgres >ps -Af|grep httpd root 5423 31100 0 16:27 pts/0 00:00:00 grep --color=auto httpd
而已!!!
Postgresql 9.0.4的“ http://www.openscg.org/se/postgresql/packages.jsp ”安装将把.s.PGSQL.5432文件放在/ tmp中,而不是在ubuntu上的/ var / run / postgresql中。可能还有debian。
快速肮脏的解决scheme是:
ln -s /tmp postgresql
谁知道它应该如何修复?