redmine 続き apache, network config, service dispatch

Configure apache

The next part is to configure Virtualhost in Apache for Redmine to work. Add the following line in /etc/apache2/sites-enabled/000-default


ServerName www.mywebsite.com
ProxyPass / http://www.mywebsite.com:3000/
ProxyPassReverse / http://www.mywebsite.com:3000/

The above lines assume that you want your Redmine installation to be accessible via the www.mywebsite.com address. You can change that to fit your need.
The ProxyPass above require you to enable the proxy modules in Apache. Run the following command to do that.

もしここで例えばポート4000を使いたいのなら:


ServerName www.mywebsite.com
ProxyPass / http://www.mywebsite.com:3000/
ProxyPassReverse / http://www.mywebsite.com:3000/

/etc/apache2/ports.conf
NameVirtualHost *:3192
Listen 3192

  • /etc/init.d/networking restart
  • sudo a2enmod proxy proxy_http

Configure htaccess
The next step is to configure Apache's htaccess. Change the file /usr/share/redmine/public/.htaccess to the following

  • RewriteEngine On
  • RewriteBase /
  • RewriteRule ^$ index.html [QSA]
  • RewriteRule ^([^.]+)$ $1.html [QSA]
  • RewriteCond %{REQUEST_FILENAME} !-f
  • RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

Restart apache
Once everything is configured, Apache need to be restarted for changes to take effect. Run the following command at the terminal.

  • sudo /etc/init.d/apache2 restart

もしここで以下の警告がでるときは
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

/etc/apache2/apache2.conf に以下を追加
ServerName 127.0.0.1

Start service
You can start the web service with the following command, and start using Redmine at the address you configured your Apache webserver, or by pointing your browser to port 3000 of the server's address.

  • ruby /usr/share/redmine/script/server webrick -e production

Configure cron
The web service need to be started every time the system is booted. To do this, run the following command to edit your crontab

  • crontab -e

And add the following line to start the service automatically during system boot.

  • @reboot ruby /usr/share/redmine/script/server webrick -e production