帮助! Apache 2 的 Passenger 子 URI 不起作用!
我正在尝试使用 Apache2 和 Passenger 3.0.7 在 Ubuntu 8.04 上设置 Redmine 1.1.3 应用程序。 我已经通过运行 Webrick 作为 Web 服务器来验证我安装的 Redmine 是否正常工作。据我了解,它不是推荐用于生产的 Web 服务器,因此我决定使用 Apache 2 托管它。
我计划配置 Apache Web 服务器以支持子 URI,请参考指南: http://www.modrails.org/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri。 但是,我在“sites-available”文件夹中名为“default”的 Apache2 配置文件的配置方面遇到了一些问题。
以下是我在“默认”文件中的配置:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.mydomain.com
**DocumentRoot /var/www**
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/redmine>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
RailsBaseURI /redmine
RailsEnv production
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
通过“http”//www.mydomain.com 访问 Redmine 后,此配置返回了“没有要加载的此类文件 -- /var/www/config/environment”错误/redmine”。
只有当我将“文档根目录”更改为“/usr/local/redmine-1.1.3/public”(Redmine 应用程序代码所在的位置)时,才能克服此错误。
笔记: 1.我已经按照指南中的说明在“/var/www/redmine”中创建了符号链接。 2.我还将整个“redmine-1.1.3”文件夹和文件(递归地)“chown”到“www-data”。
如果有人能帮助我正确配置我的设置,我将不胜感激,因为我真的希望利用子 URI 方法,以便我可以为多个应用程序维护公共端口“80”的使用。
先感谢您。
干杯,
凯文
I am trying to setup Redmine 1.1.3 application on my Ubuntu 8.04 with Apache2 and Passenger 3.0.7.
I have verified that my installation of Redmine is working properly by running Webrick as web server. As I have read that it is not the recommended webserver for Production, I have decided to host it using Apache 2.
I am planning to configure the Apache webserver to support sub-URI, with reference to the guide: http://www.modrails.org/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri.
However, I am having some problem with the configuration of the Apache2's config file called "default" in the "sites-available" folder.
Below is my configuration in the "default" file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.mydomain.com
**DocumentRoot /var/www**
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/redmine>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
RailsBaseURI /redmine
RailsEnv production
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
This configuration has returned with a "no such file to load -- /var/www/config/environment" error, after accessing Redmine via "http"//www.mydomain.com/redmine".
This error is only overcome if I change the "Document Root" to "/usr/local/redmine-1.1.3/public", which is where the Redmine application codes is located.
Note:
1. I have already created the symlink in "/var/www/redmine" as described in the guide.
2. I have also "chown" the entire "redmine-1.1.3" folders and files (recursively) to "www-data".
I will appreciate if anyone can help me to configure my setup correctly as I really hope to make use of the sub-URI approach, so that I can maintain the use of a common port "80" for multiple applications.
Thank you in advance.
Cheers,
Kevin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 Mac 上有类似的设置。我的设置没有虚拟主机,因为我想保持一些 php 应用程序运行,而如果为整个站点启用,则 Passenger 会干扰这些应用程序。
我的 apache httpd.conf 文件中包含两个安装文件:
passenger.conf
redmine.conf
我的系统是 Mac,所以路径可能不同,但我在文档根目录中设置了一个符号链接,指向我的 redmine 的公共目录。
也许“RailsBaseURI”将是让它为您工作的关键。
I have a similar setup working on Mac. Mine is setup without Virtual Hosts since I wanted to keep some php apps running and Passenger was interfering with those if enabled for the entire site.
I have two setup files included from my apache httpd.conf file:
passenger.conf
redmine.conf
My system is Mac so the paths might be different, but I have it set up with a symlink in my docroot pointing to my redmine's public directory.
Perhaps the "RailsBaseURI" will be the key to getting it working for you.