我有一个网站,我想在其下安装redmine(rails应用程序),以便我可以访问redmine作为子目录(http://mywebsite.foobar.com/redmine)。我已经安装了redmine,我可以在本地访问它(lynx http://localhost:3000),但当我尝试通过键入其地址时通过浏览器访问它时,我得到了文件列表。如何使应用程序可访问?我确实安装了乘客。我的虚拟主机文件如下:
1 <VirtualHost *:80>
2 ServerName mywebsite.foobar.com
3 ServerAlias www.mywebsite.foobar.com
4 ServerAdmin admin@foobar.com
5 Redirect permanent / https://mywebsite.foobar.com/
6
7 DocumentRoot /path/to/www/
8 ReadmeName README.html
9 IndexOptions SuppressHTMLPreamble
10
11 <Directory "/path/to/www">
12 Options Indexes FollowSymLinks
13 Order allow,deny
14 Allow from all
15 → Require all granted
16 IndexIgnore ..
17 IndexIgnore README.html
18 </Directory>
19
20 RailsEnv production
21 → → RewriteEngine on
22 → → → Alias /redmine /path/to/www/redmine/public/
23 → → → <Directory "/path/to/www/redmine/public/">
24 → → → → Order allow,deny
25 → → → → allow from all
26 → → Options +Indexes +FollowSymLinks -MultiViews +ExecCGI
27 → → Require all granted
28 → → → </Directory>
29
30
31
32 Include aliases.conf
33 Include /etc/apache2/foobar/security.conf
34 </VirtualHost>
此外,我的https虚拟主机看起来像这样:
1 <VirtualHost *:443>
2 SSLEngine On
3 SSLCertificateFile /etc/apache2/ssl/foobar.crt
4 SSLCertificateKeyFile /etc/apache2/ssl/foobar.key
5 SSLCertificateChainFile /etc/apache2/ssl/gd_bundle.crt
6
7 ServerName mywebsite.foobar.com
8 ServerAlias www.mywebsite.foobar.com
9 ServerAdmin admin@foobar.com
10 UseCanonicalName Off
11
12 DocumentRoot /path/to/www/
13 RailsEnv Production
14 RewriteEngine on
15
16 <Directory "/path/to/www/">
17 Require all granted
18 </Directory>
19
20
21 Alias /redmine /path/to/www/redmine/public
22
23 <Location /redmine>
24 PassengerBaseURI /redmine
25 PassengerAppRoot /path/to/www/redmine/public/
26 </Location>
27
28 <Directory "/path/to/www/redmine/public">
29 Order allow,deny
30 allow from all
31 Options +Indexes +FollowSymLinks -MultiViews +ExecCGI
32 Require all granted
33 </Directory>
34
35 Include /etc/apache2/foobar/security.conf
36
37
38 </VirtualHost>
P.S:网站本身作为虚拟主机提供,因此redmine将成为虚拟主机下的目录。
答案 0 :(得分:0)
确定。所以我在passenger documentation找到了我的解决方案:我基本上不得不改变选项。相关选项如下:
39 Alias /redmine /path/to/www/redmine/public/
40 <Location /redmine>
41 PassengerBaseURI /redmine
42 PassengerAppRoot /path/to/www/redmine
43 </Location>
44 <Directory /path/to/www/redmine/public>
45 Allow from all
46 Options +Indexes +FollowSymLinks -MultiViews +ExecCGI
47 Require all granted
48 </Directory>