apache2 mongrel

sudo apt-get install apache2
sudo gem install mongrel
sudo gem install mongrel_cluster


#start.sh
mongrel_rails start -d -p 8000 -e production -P log/mongrel-1.pid
mongrel_rails start -d -p 8001 -e production -P log/mongrel-2.pid
@restart.sh
mongrel_rails restart -P log/mongrel-1.pid
mongrel_rails restart -P log/mongrel-2.pid


#配置apache2(装载 http://forum.ubuntu.org.cn/viewtopic.php?t=68851)

2.Apache 的设置
首先要启动mod_proxy模块.
代码:
cd /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/proxy_balancer.load proxy_balancer.load
sudo ln -s ../mods-available/proxy_http.load proxy_http.load
sudo ln -s ../mods-available/proxy.load proxy.load
sudo ln -s ../mods-available/proxy.conf proxy.conf


接着要修改一下proxy.conf文件
代码:
sudo vim /etc/apache2/mods-available/proxy.conf


大概是在11行:
代码:
#Allow from .example.com

改为
代码:
Allow from all


修改 /etc/apache2/apache2.conf 文件(默认是在最后一行):
代码:
Include /etc/apache2/sites-enabled/

改为:
代码:
#Include /etc/apache2/sites-enabled/

然后在/etc/apache2/httpd.conf里添加以下部分:
代码:
<Proxy balancer://mongrel>
  BalancerMember http://127.0.0.1:8000
  BalancerMember http://127.0.0.1:8001
</Proxy>

<VirtualHost *:80>
  ProxyPass / balancer://mongrel/
  ProxyPassReverse / balancer://mongrel/
</VirtualHost>


重启Apache以使设置生效:
代码:
sudo /etc/init.d/apache2 restart

你可能感兴趣的:(apache,PHP,ubuntu,vim,Rails)