Apache+MongrelでRailsを動かす
Apache+MongrelでRailsで作ったアプリケーションのproduction環境を構築した際のメモ。
まずはMongrelでRailsを動かしてみる。
[root@emma ~]# gem install mongrel [root@emma ~]# exit [yuanying@emma ~]$ cd web/books // アプリケーションのディレクトリに移動. [yuanying@emma books]$ rake environment RAILS_ENV=production migrate [yuanying@emma books]$ mongrel_rails start -d -e production
その後httpd.confを編集。
<VirtualHost *:80>
ServerAdmin webmaster@******
DocumentRoot /path/to/web/application
ServerName books.example.com
ErrorLog logs/books.example.com-error_log
CustomLog logs/books.example.com-access_log combined
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
そしてApacheの再起動。
[root@emma ~]# /etc/rc.d/init.d/httpd restart