Hi. I have a dedicated server (linux / rails / mongrel) that I'm deploying to. I am able to deploy different applications to different domains/subdomains just fine using the standard rails / mongrel / apache config (as instructed from agile web second edition).
However, the kink is I need to deploy lots of rails applications under the same domain. The reason for this is the applications need to be directly callable from the parent application (at the root domain) via AJAX so they need to be on the same domain. Calling an ajax request on sub-domains fail. I know there are a bunch of javascript hacks, but for now I'd like to just deploy the apps to the same domain (using virtual folders to identify them). Here is what I'm after: http://[domain] -> Rails Parent App (mongrel ports 8000-8001) http://[domain]/app1/ -> Rails Child App 1 (mongrel ports 8010-8011) http://[domain]/app2/ -> Rails Child App 2 (mongrel ports 8020-8021) etc... The mongrel instances are set up fine for all my apps. I just need to fix up the mod_rewrite in order to forward the requests based on folder name to different mongrel instances. I don't mind putting the child app names and paths statically into the config for now. What I have tried so far is using a rewrite rule that picks the http://[domain]/app1/[rails path] and forwards it to the mongrel cluster defined by app1_cluster. RewriteRule ^/(.*)/app1/(.*)$ balancer://app1_cluster%{REQUEST_URI} [P,QSA,L] Needless to say, it doesn't work. I don't think the RewriteRule is being hit because I cant get the /app1/ requests to hit the right mongrel cluster. All I get is 404s. The parent rails app works fine at the root of the domain. I'm guessing my RewriteRule is probably way off. Thanks in advance for any help you can offer. -Jacques [EMAIL PROTECTED] Here is my full apache virtual server config file. Its mostly standard issue from: http://mongrel.rubyforge.org/docs/apache.html ---- <VirtualHost 211.149.251.41> ServerName dev.you-comics.com DocumentRoot /var/www/apps/youcomics/current/public <Directory "/var/www/apps/youcomics/current/public"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> # Configure Mongrel Cluster <Proxy balancer://youcomics_cluster> BalancerMember http://127.0.0.1:8010 BalancerMember http://127.0.0.1:8011 </Proxy> <Proxy balancer://app1_cluster> BalancerMember http://127.0.0.1:8020 BalancerMember http://127.0.0.1:8021 </Proxy> RewriteEngine On # Prevent access to .svn directories RewriteRule ^(.*/)?\.svn/ - [F,L] ErrorDocument 403 "Access Forbidden" # Check for maintenance file and redirect all requests RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^.*$ /system/maintenance.html [L] # 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 #app1 RewriteRule ^/(.*)/app1/(.*)$ balancer://app1_cluster%{REQUEST_URI} [P,QSA,L] #main dashboard RewriteRule ^/(.*)$ balancer://youtcomics_cluster%{REQUEST_URI} [P,QSA,L] # Deflate AddOutputFilterByType DEFLATE text/html text/plain text/xml BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html ErrorLog logs/youcomics.com-error_log CustomLog logs/youcomics.com-access_log combined </VirtualHost> ----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Deploying Rails" group. To post to this group, send email to rubyonrails-deployment@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-deployment?hl=en -~----------~----~----~----~------~----~------~--~---