我试图在Ubuntu服务器上安装rails 3.0.10。我用的是postgres 9.0.4,Apache和客运。当我运行我的服务器时,我会得到以下错误:
PGError无法连接到服务器:没有这样的文件或目录是服务器在本地运行并接受Unix域套接字"/var/run/postgresql/.s.PGSQL.5432“上的连接吗?
很自然,postgres服务器正在运行,如果我使用“rails服务器”,这个应用程序在webbrick中运行得很好。
在安装过程中,我将Postgres和Apache作为root安装,而使用rvm作为另一个用户安装ruby和rails。会是这样吗?
从linux用户的角度来看,安装生产服务器的正确方法是什么?将所有东西安装为root或创建部署程序帐户,并使用sudo安装postgres、apache和客运,或者甚至没有sudo?
有什么建议吗?没有太多关于生产服务器安装/conf的好教程。认识一个吗?
BR
发布于 2011-08-19 00:47:52
检查config/database.yml,开发和生产环境可能有不同的DB设置。
记住在production (RailsEnv)中创建数据库,或者只是将开发部分下的凭据复制到config/database.yml中的生产部分
将PG & Apache作为root安装是没有错的,这是保护这些程序的正确方法。
RoR和rvm可以作为非根用户安装,为Apache和乘客创建另一个用户,使用'sudo‘启动Apache。
确保您为Apache安装的用户能够访问日志和上载目录。
发布于 2011-08-20 14:32:27
我将postgres日志设置为登录信息,当我浏览页面时什么也看不见。WHen在PGAdmin里玩,我在日志里看到了一些东西。我知道httpd作为root运行,postgres作为用户postgres运行。Rails被安装为只属于组rutger的用户rutger。
netstat -an|grep侦听
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 httpdhttps://serverfault.com/questions/302902
复制相似问题