Ruby on rails 如何使用Apache和Passenger在子域根上部署Rails应用程序

Ruby on rails 如何使用Apache和Passenger在子域根上部署Rails应用程序,ruby-on-rails,ruby,apache,deployment,passenger,Ruby On Rails,Ruby,Apache,Deployment,Passenger,我在子uri redmine.example.org/redmine上有正在运行的Rails应用程序,我希望它在redmine.example.org上运行 /var/www/work/redmine.src获得批准 /var/www/work/redmine是指向/var/www/work/redmine.src/public的符号链接 DocumentRoot/var/www/work ServerName redmine.example.org ErrorLog/var/log/apach

我在子uri redmine.example.org/redmine上有正在运行的Rails应用程序,我希望它在redmine.example.org上运行

/var/www/work/redmine.src获得批准
/var/www/work/redmine是指向/var/www/work/redmine.src/public的符号链接
DocumentRoot/var/www/work
ServerName redmine.example.org
ErrorLog/var/log/apache2/redmine-error\u log
CustomLog/var/log/apache2/redmine-access\u日志组合
允许超越所有
选项-多视图
命令允许,拒绝
通融
RackBaseURI/红矿
选项-多视图
命令允许,拒绝
通融
我尝试了很多组合和谷歌搜索时间,但都没有效果

我应该如何更改此配置以在子域根上部署redmine


提前感谢。

部署sub-uri应用程序的另一种方法可能也适用于您:

<VirtualHost *:80>
    ProxyPass /sub_uri/ http://localhost:8000/sub_uri/

    DocumentRoot /main_app/public
    <Directory /main_app/public>
       ...
    </Directory>
</VirtualHost>

<VirtualHost *:8000>
  DocumentRoot /sub_uri/public
  <Directory /sub_uri/public>
    ...
    SetEnv RAILS_RELATIVE_URL_ROOT /sub_uri
  </Directory>
</VirtualHost>

ProxyPass/sub_uri/http://localhost:8000/sub_uri/
DocumentRoot/main\u应用程序/公共
...
DocumentRoot/sub_uri/public
...
SetEnv RAILS\u RELATIVE\u URL\u ROOT/sub\u uri

部署sub-uri应用程序的另一种方法可能也适用于您:

<VirtualHost *:80>
    ProxyPass /sub_uri/ http://localhost:8000/sub_uri/

    DocumentRoot /main_app/public
    <Directory /main_app/public>
       ...
    </Directory>
</VirtualHost>

<VirtualHost *:8000>
  DocumentRoot /sub_uri/public
  <Directory /sub_uri/public>
    ...
    SetEnv RAILS_RELATIVE_URL_ROOT /sub_uri
  </Directory>
</VirtualHost>

ProxyPass/sub_uri/http://localhost:8000/sub_uri/
DocumentRoot/main\u应用程序/公共
...
DocumentRoot/sub_uri/public
...
SetEnv RAILS\u RELATIVE\u URL\u ROOT/sub\u uri

嗯,这比我想象的要容易

当我反复阅读手册时,我找到了解决方案:

现在,我的配置文件如下所示:

<VirtualHost *:80>
    DocumentRoot /var/www/work/redmine.src/public
    ServerName redmine.example.org

    <Directory /var/www/work/redmine.src/public>
        AllowOverride all
        Options -MultiViews
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

DocumentRoot/var/www/work/redmine.src/public
ServerName redmine.example.org
允许超越所有
选项-多视图
命令允许,拒绝
通融

嗯,这比我想象的要容易

当我反复阅读手册时,我找到了解决方案:

现在,我的配置文件如下所示:

<VirtualHost *:80>
    DocumentRoot /var/www/work/redmine.src/public
    ServerName redmine.example.org

    <Directory /var/www/work/redmine.src/public>
        AllowOverride all
        Options -MultiViews
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

DocumentRoot/var/www/work/redmine.src/public
ServerName redmine.example.org
允许超越所有
选项-多视图
命令允许,拒绝
通融

我使用发行版本身提供的软件包(Apache+Redmine+Ruby+Rails+Passenger+MariaDB)在Debian 9.0 Stretch服务器上安装了Redmine 3.3.1,大致遵循以下指南:

我想离开
www.example.org
“for Apache”和
redmine.example.org
“for redmine”,因此我完成了以下设置

我将
/etc/apache2/sites available/000 default.conf
保持不变,并在同一文件夹中创建了一个名为
redmine.conf
的文件:

<VirtualHost *:80>
    ServerName redmine.example.org
    DocumentRoot /usr/share/redmine/public
    PassengerRuby /usr/bin/ruby
    <Directory /usr/share/redmine/public>
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory>
</VirtualHost>
要设置该虚拟主机,我按照以下说明操作:

  • 在Passenger+Apache上部署Ruby应用程序
    • 将应用程序部署到虚拟主机的根目录

我使用发行版本身提供的软件包(Apache+Redmine+Ruby+Rails+Passenger+MariaDB)在Debian 9.0 Stretch服务器上安装了Redmine 3.3.1,大致遵循以下指南:

我想离开
www.example.org
“for Apache”和
redmine.example.org
“for redmine”,因此我完成了以下设置

我将
/etc/apache2/sites available/000 default.conf
保持不变,并在同一文件夹中创建了一个名为
redmine.conf
的文件:

<VirtualHost *:80>
    ServerName redmine.example.org
    DocumentRoot /usr/share/redmine/public
    PassengerRuby /usr/bin/ruby
    <Directory /usr/share/redmine/public>
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory>
</VirtualHost>
要设置该虚拟主机,我按照以下说明操作:

  • 在Passenger+Apache上部署Ruby应用程序
    • 将应用程序部署到虚拟主机的根目录

我没有启用mod_代理,我希望有更好的解决方案。但我会尝试…我没有启用mod_代理,我希望有更好的解决方案。但我会试试。。。