[Mongrel] problem with mongrel/apache2.2.3 and subdomain setup

Charles Brian Quinn me at seebq.com
Tue Jan 2 13:50:43 EST 2007


I'd add another:

 <VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>

for your main document root, since you're using VirtualHosts.

and make sure that loads last -- this could mean if you're doing something like:

Include /etc/rails/*.conf

in an apache configuration file that you name the files accordingly
(perhaps 00_my_site.conf and 99_default_vhost.conf)

hope that helps,
-- 
Charles Brian Quinn
self-promotion: www.seebq.com
highgroove studios: www.highgroove.com
slingshot hosting: www.slingshothosting.com

Ruby on Rails Bootcamp at the Big Nerd Ranch
Intensive Ruby on Rails Training:
http://www.bignerdranch.com/classes/ruby.shtml

On 1/2/07, Rob Sanheim <rsanheim at gmail.com> wrote:
> Hi all
>
> I got a vps setup amazingly fast using the deprec recipes on Ubuntu
> edgy, but now I'm having a minor issue where my site loads for the
> main domain when I only want it accessible from the subdomain.   This
> is a pretty typical setup, apache 2.2.3 -> mongrel_proxy_balancer ->
> mongrel cluster.  I'm sure I'm missing something obvious in the
> config...
>
> I have the conf files pasted below.  Should I just be able to set the
> ServerName like I did in myapp.conf for this to work?  Do I need to do
> something else in the stock apache config?
>
> Here's the relevant config files:
>
> mongrel_cluster.yml:
> ========================
> cwd: /var/www/apps/myapp/current
> port: "8000"
> environment: production
> address: 127.0.0.1
> pid_file: log/mongrel.pid
> servers: 2
>
> myapp.conf
> ============================
> <VirtualHost *:80>
>   ServerName myapp.domain.com
>
>   DocumentRoot /var/www/apps/myapp/current/public
>
>   <Directory /var/www/apps/myapp/current/public>
>     Options FollowSymLinks
>     AllowOverride None
>     Order allow,deny
>     Allow from all
>   </Directory>
>
>   # Configure mongrel_cluster
>   <Proxy balancer://myapp_cluster>
>     BalancerMember http://127.0.0.1:8000
>     BalancerMember http://127.0.0.1:8001
>   </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
>   RewriteRule ^/(.*)$ balancer://myapp%{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/myapp.domain.com-error_log
>   CustomLog logs/myapp.domain.com-access_log combined
> </VirtualHost>
> =========================
> the apache httpd.conf is pretty stock, but here's the part that I
> _thought_ would allow me to serve from the main domain just using
> apache:
>
> ServerName domain.com
> DocumentRoot "/usr/local/apache2/htdocs"
> <Directory />
>     Options FollowSymLinks
>     AllowOverride None
>     Order deny,allow
>     Deny from all
> </Directory>
> <Directory "/usr/local/apache2/htdocs">
>     Options Indexes FollowSymLinks
>     AllowOverride None
>     Order allow,deny
>     Allow from all
> </Directory>
>
> thanks,
> Rob
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>


More information about the Mongrel-users mailing list