简体   繁体   English

乘客的VirtualHost问题(mod_rails)

[英]VirtualHost problem with passenger (mod_rails)

I'm at my wit's end here with virtual hosting. 我在这里拥有虚拟主机。 I'm trying to install redmine and it works with the webrick test server, but when I tried to use passenger (mod_rails) to host and go to the address I specified when in the virtualhost part of my apache config file nothing happens. 我正在尝试安装redmine,并且它可以与webrick测试服务器一起使用,但是当我尝试使用乘客(mod_rails)托管并转到我在apache配置文件的virtualhost部分中指定的地址时,没有任何反应。 Here is the relavent section of /etc/httpd/conf/httpd.conf where I try to set up the virtual host: 这是/etc/httpd/conf/httpd.conf的相关部分,我尝试在其中设置虚拟主机:

<VirtualHost *:80>

SetEnv RAILS_ENV production
ServerName redmine.MYSITE.com:80
DocumentRoot /opt/redmine-1.0.5/public/
<Directory /opt/redmine-1.0.5/public/>
    Options -MultiViews
    Allow from all
    AllowOverride none
</Directory>

However, when I got to redmine.MYSITE.com:80 nothing happens, I just get our normal home page. 但是,当我必须使用redmine.MYSITE.com:80时,什么也没发生,我只得到了正常的主页。 I have no idea what the problem is, any help our guidance would be greatly appreciated. 我不知道问题是什么,我们的指导将不胜感激。 If you need any other information, please tell me and I'll provide it. 如果您需要其他任何信息,请告诉我,我会提供。

It took me a while to get Redmine running under Passenger. 我花了一些时间才让Redmine在“乘客”下运行。 This is what I have 这就是我所拥有的

Install passenger: 安装乘客:

passenger-install-apache2-module

Edit Apache confg file: 编辑Apache confg文件:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11
PassengerRuby /usr/bin/ruby

Create a new directory in the default server: 在默认服务器中创建一个新目录:

<Directory>
/webserver_root/html/redmine
RailsBaseURI /redmine
AllowOverride all
Options -MultiViews
</Directory>

Lastly, make a link to the physical directory where your ruby apps live (ie NOT under /html or whatever directory you serve most Apache pages from. This MUST be a link to redmine's public subdirectory) 最后,链接到您的ruby应用程序所在的物理目录(即,不在/ html或您为大多数Apache页面提供服务的目录下。此链接必须是redmine的公共子目录的链接)

ln -s /webserver_root/ruby_apps/redmine/public /webserver_root/html/redmine

So Apache now tries to show all the public pages as normal, but all other pages get routed through passenger. 因此,Apache现在尝试正常显示所有公共页面,但所有其他页面都通过乘客进行路由。 You access it as a subfolder - eg. 您可以将其作为子文件夹访问-例如。 http://mywebserver/redmine HTTP:// MyWebServer的/管理平台

Your VirtualHost *:80 directive must be matched by a corresponding NameVirtualHost *:80 earlier in your config. 您的VirtualHost *:80指令必须与配置中前面的相应NameVirtualHost *:80匹配。

You can ask apache what it makes of your vhosts with the -S switch. 您可以使用-S开关询问apache对您的虚拟主机有何影响。 Of course, the name of your server binary depends somewhat on how it was installed and on what OS/Distro . 当然,服务器二进制文件的名称在某种程度上取决于它的安装方式以及所使用的OS / Distro

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM