我在sub-uriredmine.example.org/redmine上运行Rails应用程序,我希望它在redmine.example.org上运行
/var/www/work/redmine.src is approot
/var/www/work/redmine is symlink to /var/www/work/redmine.src/public
<VirtualHost *:80>
DocumentRoot /var/www/work
ServerName redmine.example.org
ErrorLog /var/log/apache2/redmine-error_log
CustomLog /var/log/apache2/redmine-access_log combined
<Directory /var/www/work/redmine>
AllowOverride all
Options -MultiViews
Order allow,deny
allow from all
</Directory>
RackBaseURI /redmine
<Directory /var/www/work/redmine.src>
Options -MultiViews
Order allow,deny
allow from all
</Directory>
</VirtualHost>
我尝试了很多组合,并在谷歌上搜索了几个小时,但都不起作用。
我应该如何更改此配置以在子域根上部署redmine?
提前谢谢。
嗯,这比我想象的要容易。
当我一遍又一遍地阅读手册时,我找到了解决方案:链接到手动
现在我的配置文件如下:
<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>
部署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>
我在Debian 9.0 Stretch服务器上安装了Redmine 3.3.1,使用的是发行版本身提供的软件包(Apache+Redmine+Ruby+Rails+Passenger+MariaDB),或多或少遵循以下指南:
http://www.redmine.org/projects/redmine/wiki/RedmineInstallhttp://www.redmine.org/projects/redmine/wiki/InstallRedmineOnDebianStableApacheMysqlPassenger
我想把www.example.org
"留给Apache",把redmine.example.org
"留给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>
然后,我将其链接到sites-enabled
文件夹,并重新启动Apache:
#ln-s/etc/apache2/可用的站点/redmine.conf/etc/apache2/已启用的站点/redmin.conf#systemctl重新启动apache2
为了设置虚拟主机,我遵循了以下指示:
- 在Passenger+Apache上部署Ruby应用程序
- 将应用程序部署到虚拟主机的根目录https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/#deploying-一个应用程序到一个虚拟主机-s-root