首页 >数据库 >mysql教程 >apache2+passenger遇到的问题总结:

apache2+passenger遇到的问题总结:

WBOY
WBOY原创
2016-06-07 15:13:101388浏览

参考文章: 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.htm


参考文章:
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>
      ServerName 127.0.0.1
      DocumentRoot /var/www/html/
      ErrorLog logs/redmine_error_log

      RailsBaseURI /redmine
      RailsEnv production
      <directory>
         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></directory>

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












声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn