简体   繁体   English

apache2 debian上的redmine子网址

[英]redmine sub-url on apache2 debian

I had instaled Redmine under Debian8 and Apache/2.4.10 (Debian), it works great. 我在Debian8和Apache / 2.4.10(Debian)下安装了Redmine,它运行良好。 The default instalation causes, it is only app served by Apache... After mamy googling links and hints, I try change it with Apache configuration in way described here: 默认安装原因是,它仅由Apache提供服务。在搜索了许多链接和提示后,我尝试按以下描述的方式使用Apache配置对其进行更改:

basic Redmine file ( /etc/apache2/sites-available/redmine.conf ) is: 基本的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>

so, I try to move this settings a little bit upper - from sites-available to conf-available (similar like phpMyAdmin), and created /etc/apache2/conf-available/redmine.conf : 因此,我尝试将此设置稍高一些-从站点可用到conf可用(类似于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>

and I added: 我补充说:

RedmineApp::Application.routes.default_scope = "/redmine"

to file: /usr/share/redmine/config/environment.rb (according to hint in: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI ) 到文件: /usr/share/redmine/config/environment.rb (根据以下提示: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI : http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI

...and :-( now Redmine works with 'localhost/redmine' but eg. phpMyAdmin doesnt work and behave like bad redmine-link ...和:-(现在Redmine可以与'localhost / redmine'一起使用,但是例如phpMyAdmin无法正常工作,并且表现得像不良的redmine-link

When I remove DocumentRoot /usr/share/redmine/public line from redmine.conf - all works except redmine... link localhost/redmine show: 当我从redmine.conf删除DocumentRoot /usr/share/redmine/public redmine.conf -除redmine外的所有工作...链接localhost/redmine显示:

Forbidden You don't have permission to access /redmine/ on this server. 禁止您无权访问此服务器上的/ redmine /。

and Apache error.log : 和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 ...

My question is: is there a way to use DocumentRoot depending on match Alias? 我的问题是:有没有一种方法可以根据匹配别名使用DocumentRoot Or maybe is another way to fix it... 也许是另一种解决方法...

EDIT: 编辑:

when redmine.conf is changed to: 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>

And, at the end of file environment.rb , I have added: 并且,在文件environment.rb的末尾,我添加了:

Redmine::Utils::relative_url_root = "/redmine"

Now it works (Redmine and phpMyAdmin and other php) perfect! 现在可以正常使用了(Redmine和phpMyAdmin及其他php)!

:-) :-)

Since you are already using Passenger, the proper value to pass if your app is in sub-folder is: 由于您已经在使用Passenger,因此如果您的应用程序位于子文件夹中,则传递的正确值为:

PassengerBaseURI /redmine 

From their website, just replace subapp with redmine... 在他们的网站上,只需将subapp替换为redmine ...

<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>

Complete integration guide is: 完整的集成指南是:

https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/ https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/

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

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