Apache + Mongrel 设置

本文介绍如何在Ubuntu系统中配置Apache以支持Rails应用程序,并详细展示了httpd.conf文件的配置示例,包括设置字符集、代理转发及静态资源映射等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值