Apache + Mongrel 设置
Ubuntu下,打开/etc/apache2/httpd.conf,键入下面段落:<VirtualHost yourip>
AddDefaultCharset utf-8
ServerName www.yourhost.com
DocumentRoot /path/to/railsapp/public
ErrorDocument 500 /500.html
ErrorDocument 404 /404.html
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass /javascripts !
#continue with other static files that should be served by apache
Alias /images/path/to/railsapp/public/images
Alias /stylesheets /path/to/railsapp/public/stylesheets
Alias /javascripts/path/to/railsapp/public/javascripts
#continue with aliases for static content
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Directory/path/to/railsapp/public/>
Options Indexes FollowSymLinks
Order allow,deny
allow from all
</Directory>
</VirtualHost>
启动
mongrel_rails start -d -p 3000 -e production -P /path/to/railsapp/log/mongrel-1.pid
这样应该就可以通过www.yourhost.com访问Rails app了。
转自:
http://www.agiletao.com/read.php?tid=371
页:
[1]