更新时间:2023-12-04 10:47:58
他们将在一个更安全和更系统的方式在服务器启动你的App照顾,什么是现在或多或少的标准。
我不得不使用Rails 4和Ruby 2.1同样的问题在CentOS 6.如果你不熟悉的bash脚本和RC,型材系统 - 它的速度更快,更容易安装乘客
。
另外,还有一些其他的原因,你会去的乘客,包括安全和性能(www.phusionpassenger.com)
下面是一个快速如何做的什么了我介绍的宝石。
安装Apache(HTML守护进程)和依赖包(如果没有他们的话):
百胜安装的httpd卷曲DEVEL的httpd-DEVEL
块引用>
获得Apache在引导时启动:
chkconfig的httpd的上
块引用>
安装的Phusion乘客和依赖包:
创业板安装客运结果
百胜安装卷曲DEVEL的httpd-DEVEL
块引用>
编译环境:
乘客安装-Apache2的模块
块引用>
编辑等在Apache的配置文件/的httpd / conf目录/ httpd.conf文件
取消注释包含行了NameVirtualHost *:80
接近尾声
在文件的结尾粘贴的任何地方,从4点输出),例如:
的LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby
<虚拟主机*:80>
服务器名称1.2.3.4#www.whatever.com
的DocumentRoot的/ var / WWW /导轨/公共#的路径Rails应用程序
<目录/ var / WWW /导轨/公共>
所有的AllowOverride
选项-MultiViews
< /目录>
< /虚拟主机>
块引用>
我花了30分钟,共有包括与httpd.conf中得到的一切权利几个试的错误。
请注意,安装需要你的机器上至少有1 GB RAM。
I'd like my rails server to start automatically after every reboot, so I added the following to my .bashrc file
rvm use 1.9.2
cd /home/user/myapp
rails server
With that, the server never starts automatically after a reboot, and I have to start it manually.
Also, when I login to start the server, I see the following message
Using /usr/local/rvm/gems/ruby-1.9.2-p290
/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby: symbol lookup error: /usr/local/rvm/gems/ruby-1.9.2-p290/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_initialize
As a consequence, I need to install sqlite3 after every reboot using "gem install sqlite3" after I make myself superuser, and only then I can start the rails server without issues.
$ cat /etc/*-release
CentOS release 5.8 (Final)
$ rails -v
Rails 3.1.1
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
Anyone can please help me overcome this issue? Thanks
They will take care of starting your App with the server in a safer and more systematic way and what is now more or less a standard.
I had the same issue with Rails 4, Ruby 2.1 on CentOS 6. If you're not familiar with bash scripts and the rc, profiles system - it's much faster and easier to setup passenger
.
Also, there are other reasons why you would go for passenger, including security and performance ( www.phusionpassenger.com )
Here is a quick how-to of what it took me to introduce the gem.
Install Apache (html daemon) and dependency packages (if you don't have them already):
yum install httpd curl-devel httpd-devel
Get Apache to start on boot:
chkconfig httpd on
Install Phusion Passenger and dependency packages:
gem install passenger
yum install curl-devel httpd-devel
Compile the environment:
passenger-install-apache2-module
Edit the Apache config file in etc/httpd/conf/httpd.conf
Uncomment the line containing NameVirtualHost *:80
towards the end
Paste the output from point 4) anywhere at the end of the file, eg:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby
<VirtualHost *:80> ServerName 1.2.3.4 # www.whatever.com DocumentRoot /var/www/rails/public # the path to your rails app <Directory /var/www/rails/public> AllowOverride all Options -MultiViews </Directory> </VirtualHost>
Took me 30 minutes in total, including several trial-errors with the httpd.conf to get everything right.
Note that installation requires at least 1 GB RAM on your machine.