我对 ruby on rails 和 web 开发还很陌生。这是我的设置,我从这个链接http://tonyrose023.blogspot.com/2007/01/multiple-rails-apps-with-mongrel.html 我在 Apache2 上使用 Mongrel 集群运行多个 Rails 应用程序。
http://services.abc.edu/app1 http://services.abc.edu/app2 http://services.abc.edu/app3
这就是我的“虚拟主机”(/etc/apache2/sites-availabe/services.abc.edu)文件的样子
--------------
<Proxy balancer://app1>
BalancerMember http://services.abc.edu:8000
BalancerMember http://services.abc.edu:8001
BalancerMember http://services.abc.edu:8002
Order deny,allow
Deny from all
Allow from all
</Proxy>
<Proxy balancer://app2>
BalancerMember http://services.abc.edu:8004
BalancerMember http://services.abc.edu:8005
Order deny,allow
Deny from all
Allow from all
</Proxy>
<Proxy balancer://app3>
BalancerMember http://services.abc.edu:8006
BalancerMember http://services.abc.edu:8007
Order deny,allow
Deny from all
Allow from all
</Proxy>
<VirtualHost *:80>
ServerName services.abc.edu
DocumentRoot /home/joe/projects/app1/public
<Directory "/home/joe/projects/app1/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/home/joe/projects/app2/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/home/joe/projects/app3/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
# Rewrite index to check for static
#RewriteRule ^/$ /index.html [QSA]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
#RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
RewriteRule ^/app1(.*)$ balancer://app1%{REQUEST_URI} [P,QSA,L]
RewriteRule ^/app2(.*)$ balancer://app2%{REQUEST_URI} [P,QSA,L]
RewriteRule ^/app3(.*)$ balancer://app3%{REQUEST_URI} [P,QSA,L]
</VirtualHost>
-----------------------------------------
我的问题是
1)如果有人可以评论我的设置并提供任何建议,那就太好了。
2)如您所见,我有一个 DocumentRoot,尽管现在所有 3 个应用程序都可以使用,因为它们使用相同的图像,但我认为将来我需要为每个应用程序设置 DocumentRoot
3) 我需要让应用程序安全运行,因此我需要使用 SSL(端口 443)运行它,并且我需要一些帮助以使其使用 SSL 运行。任何指针都会有所帮助,因为我从未安装过证书。我创建了 csr 和密钥,并且随身携带了证书。我正在研究下一步是什么。
谢谢!