我在Debian8和Apache / 2.4.10(Debian)下安装了Redmine,它运行得很好。默认的安装原因,它只是由Apache提供的app ... 在mamy谷歌搜索链接和提示后,我尝试使用Apache配置以这里描述的方式更改它:
基本的Redmine文件(/etc/apache2/sites-available/redmine.conf
)是:
# The passenger module (from the libapache2-mod-passenger package) must be
# enabled
<VirtualHost *:80>
# ServerName my.domain.name
# this is the passenger config eee
RailsEnv production
SetEnv X_DEBIAN_SITEID "default"
# CHANGE PassengerAppGroupName FOR OTHER INSTANCES
PassengerAppGroupName redmine_default
PassengerDefaultUser www-data
Alias "/plugin_assets/" /var/cache/redmine/default/plugin_assets/
DocumentRoot /usr/share/redmine/public
<Directory "/usr/share/redmine/public">
Allow from all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
所以,我尝试将这些设置稍微提高一点 - 从可用的站点到可用的(类似于phpMyAdmin),并创建/etc/apache2/conf-available/redmine.conf
:
Alias /redmine /usr/share/redmine/public/
PassengerDefaultUser www-data
DocumentRoot /usr/share/redmine/public
<Location /redmine>
RailsEnv production
SetEnv X_DEBIAN_SITEID "default"
# CHANGE PassengerAppGroupName FOR OTHER INSTANCES
PassengerAppGroupName redmine_default
</Location>
Alias "/redmine/plugin_assets/" /var/cache/redmine/default/plugin_assets/
<Directory "/usr/share/redmine/public/">
Allow from all
Options -MultiViews
Require all granted
</Directory>
我补充道:
RedmineApp::Application.routes.default_scope = "/redmine"
归档:/usr/share/redmine/config/environment.rb
(根据提示:http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI
)
......和:-( 现在Redmine与&localhost / redmine&#39; 但是例如。 phpMyAdmin不起作用,表现得像坏redmine-link
当我从DocumentRoot /usr/share/redmine/public
移除redmine.conf
行时 - 除了redmine之外的所有作品......链接localhost/redmine
显示:
禁 您无权访问此服务器上的/ redmine /。
和Apache error.log:
[Sun Nov 12 14:14:52.162868 2017] [autoindex:error] [pid 12220] [client ::1:45382] AH01276: Cannot serve directory /usr/share/redmine/public/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml ...
我的问题是:有没有办法根据匹配别名使用DocumentRoot
?或许是另一种解决方法......
编辑:
将redmine.conf
更改为:
[...]
#DocumentRoot /usr/share/redmine/public
[...]
<Directory "/usr/share/redmine/public/">
PassengerEnabled on
SetHandler none
PassengerAppRoot /usr/share/redmine
RailsBaseURI /redmine/redmine
Allow from all
Options -MultiViews
Require all granted
</Directory>
并且,在文件environment.rb
的末尾,我添加了:
Redmine::Utils::relative_url_root = "/redmine"
现在它的工作原理(Redmine和phpMyAdmin以及其他php)完美无缺!
: - )
答案 0 :(得分:0)
由于您已经在使用Passenger,因此如果您的应用位于子文件夹中,则传递的正确值为:
PassengerBaseURI /redmine
从他们的网站上,只需用redmine替换subapp ......
<VirtualHost *:80>
ServerName www.phusion.nl
DocumentRoot /websites/phusion/public
<Directory /websites/phusion>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
# These have been added:
Alias /subapp /websites/secondapp/public
<Location /subapp>
PassengerBaseURI /subapp
PassengerAppRoot /websites/secondapp
</Location>
<Directory /websites/secondapp/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
完整的集成指南是:
https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/