1.安装必要组件
sudo gem install passenger (安装apache passener模块)
sudo passenger-install-apache2-module(此过程可能会报错,但是会提示你怎么解决,解决后再执行这行命令)
2.重启apache服务
mcc@ubuntu:/etc/apache2$ sudo service apache2 restart
* Restarting web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
- 错误AH00558对应:
sudo vim/apache2/apache2.conf
追加:
ServerName localhost:8001
3.配置apache的配置文件
- 3.1 /etc/apache2/apache2.conf中追加
LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-5.1.4/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /var/lib/gems/1.9.1/gems/passenger-5.1.4
PassengerDefaultRuby /usr/bin/ruby1.9.1
</IfModule> 在第一步安装组件passenger的时候会提示加入这一句,所以到这一步的时候可以不用加
<VirtualHost *:8001> 此处的8001不是唯一的,因为此处服务器的80串口已被占用,所以选用没被占用的8001串口,上面的ServerName同理
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/redmine
ErrorLog logs/redmine_error_log
CustomLog ""logs/test.com-access.log"" common
<Directory ""/var/www/html/redmine"">
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
※端口最好用2000以外的,以防与其他安装的软件冲突
- 3.2 /etc/apache2/sites-available/000-default.conf添加
<Directory /var/www/html/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
4. 重启apache服务
sudo service apache2 restart
之后执行如下命令
ln -s /your/redmine/directory/public /var/www/html/redmine