apache2+passenger遇到的問題總結:



參考文章:
http://blog.csdn.net/abbuggy/article/details/8245941
http://5551543.blog.hexun.com/31625644_d.html
http://www.cnblogs.com/baizhantang/archive/2012/12/20/2827061.html

http://www.cnblogs.com/ylan2009/archive/2012/02/25/2368028.html


使用mongrel來跑ruby程序 ,Ruby提供一個安裝Ruby程序為服務的包:mongrel_service。安裝其實很簡單,運行:gem install mongrel_service

[root@test-1 config]#gem install mongrel_service

[root@test-1 config]# ruby /usr/local/redmine/script/server mongrel -e production -d
如果需要指定端口只需要加 -p 端口號


問題之前:本來可以使用mongrel來跑ruby程序,由於效率問題,以及一個同事沒有權限訪問80之外端口的原因決定部署在apache上。


安裝Passenger

[root@test-1 config]#gem install passenger
passenger-install-apache2-module

#If the second line does not work, do whereis passenger to find out where it is installed.
So you can execute it like /usr/local/bin/passenger-install-apache2-module ...

The install process is interactive and you wil be told what to do. READ!

問題1:我的redhat服務器yum沒有注冊,卸載后安裝了centos的yum。
參考文章:http://5551543.blog.hexun.com/31625644_d.html
http://www.cnblogs.com/shuaixf/archive/2011/11/30/2268496.html

下載如下包,安裝yum

[root@test-1 public]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
[root@test-1 public]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
[root@test-1 public]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm<pre code_snippet_id="235942" snippet_file_name="blog_20140317_3_9588108" name="code" class="html">[root@test-1 public]#wget http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5


問題2:我的apache passenger模塊安裝好后提示有些軟件沒有安裝,使用yum安裝,運行如下命令時,如果缺少一些安裝包,會提示,安裝即可。

<p></p><pre code_snippet_id="235942" snippet_file_name="blog_20140317_3_798598" name="code" class="html"><pre code_snippet_id="235942" snippet_file_name="blog_20140317_3_798598" name="code" class="html">[root@test-1 public]# passenger-install-apache2-module
[root@test-1 public]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/apr-devel-1.2.7-11.el5_6.5.x86_64.rpm
[root@test-1 public]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/apr-util-devel-1.2.7-11.el5_5.2.x86_64.rpm
[root@test-1 public]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/httpd-devel-2.2.3-82.el5.centos.x86_64.rpm
[root@test-1 public]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/httpd-2.2.3-82.el5.centos.x86_64.rpm


問題3:安裝完成之后提示配置apache,修改它,添加如下內容,如果還有問題只能網上搜解決了,這個用了不少時間,主要理解下面配置的含義。。

參考文章:

http://www.cnblogs.com/baizhantang/archive/2012/12/20/2827061.html

http://blog.csdn.net/abbuggy/article/details/8245941

<pre code_snippet_id="235942" snippet_file_name="blog_20140317_5_6577692" name="code" class="html">  [root@test-1 public]#vi /etc/httpd/conf/httpd.conf
LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.2
PassengerRuby /usr/local/ruby/bin/ruby
<VirtualHost *:80>
ServerName 127.0.0.1
DocumentRoot /var/www/html/
ErrorLog logs/redmine_error_log

RailsBaseURI /redmine
RailsEnv production
<Directory "/var/www/html/redmine">
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>


解決問題中常用命令,建立一個軟鏈放在apache DocumentRoot ,針對配置文件的

<p>[root@test-1 public]# ln -s /usr/local/redmine/public/ /var/www/html/redmine </p><p></p><pre code_snippet_id="235942" snippet_file_name="blog_20140314_3_4137501" name="code" class="html">      <Directory "/var/www/html/redmine">

[root@test-1 public]# service httpd restart             #重啟apache










                        
                        
                 

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com