I'm running Ubuntu 6.06LTS, Apache 2.0.55, and WebMin 1.36. I've been trying to set up static content with server-side includes to be delivered by Apache, but reverse proxying for Rails application reqeusts on a local (soon to be remote) Mongrel server at port 8000. I also wanted to have any request that is received without a specific file to be redirected to index.shtml. I've been able to get everything running EXCEPT the reverse proxy with the following config: ServerName myapp.com ServerAlias www.myapp.com ServerAdmin webmaster@localhost DocumentRoot /var/www/rails/myapp/public ErrorLog /var/www/myapp/log/apache2.log RewriteMap railservers rnd:/var/www/rails/map.txt <Directory /var/www/rails/myapp/public/> Options FollowSymLinks +Includes +ExecCGI AllowOverride None Order allow,deny Allow from all RewriteEngine On RewriteRule ^$ index.shtml [QSA]RewriteRule "^/(images|stylesheets|javascripts|pictures|graphics)/?
(.*)" "$0" [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ http://localhost:8000/$1 [P,L] </Directory> RewriteLog "/var/www/myapp/log/rewrite.log" RewriteLogLevel 0 #placed in global parameter file # Avoid open server to proxying ProxyRequests Off # Pass other requests to mongrel instance #ProxyPass / http://localhost:8000/ # Enable reverse proxying ProxyPassReverse / http://localhost:8000/ # Let apache pass the original host not the ProxyPass one ProxyPreserveHost On AddType text/html .shtml AddOutputFilter INCLUDES .shtml LogLevel debug CustomLog /var/log/apache2/access.log "combined" ServerSignature On I have a RewriteMap defined to allow me to set up a cluster of Mongrels once I get one working, since 2.0 doesn't have the balancer module. Webmin puts the proxy config in a separate file called proxy.conf which contains: <IfModule mod_proxy.c> #turning ProxyRequests on and allowing proxying from all may allow #spammers to use your proxy to send email. ProxyRequests Off <Proxy *> Order deny,allow #Deny from all Allow from all </Proxy> # Enable/disable the handling of HTTP/1.1 "Via:" headers.# ("Full" adds the server version; "Block" removes all outgoing Via:
headers) # Set to one of: Off | On | Full | Block ProxyVia Off # To enable the cache as well, edit and uncomment the following lines: # (no cacheing without CacheRoot) CacheRoot "/var/cache/apache2/proxy" CacheSize 5 CacheGcInterval 4 CacheMaxExpire 24 CacheLastModifiedFactor 0.1 CacheDefaultExpire 1 # Again, you probably should change this. #NoCache a_domain.com another_domain.edu joes.garage_sale.com </IfModule> I've tried several things: -put the rewriteengine on directive outside of the directory block: I was unable to access any page that wasn't specifically requested. -defined "ProxyPass / http://localhost:8000/": was unable to access anything (no permission to access) even though permissions are set to 775 -turned on rewritelog. here are the results for a www.myapp.com/state/list request: (3) add path info postfix: /var/www/rails/myapp/public/state -> /var/ www/rails/myapp/public/state/list (3) strip per-dir prefix: /var/www/rails/myapp/public/state/list -> state/list (3) applying pattern '^$' to uri 'state/list' (3) add path info postfix: /var/www/rails/myapp/public/state -> /var/ www/rails/myapp/public/state/list (3) strip per-dir prefix: /var/www/rails/myapp/public/state/list -> state/list (3) applying pattern '^/(images|stylesheets|javascripts|pictures| graphics)/?(.*)' to uri 'state/list' (3) add path info postfix: /var/www/rails/myapp/public/state -> /var/ www/rails/myapp/public/state/list (3) strip per-dir prefix: /var/www/rails/myapp/public/state/list -> state/list (3) applying pattern '^/(.*)$' to uri 'state/list' (1) pass through /var/www/rails/myapp/public/state It seems that the rewrite is working up to the rewritecond statement. It parses the statement pattern correctly, but the file state/list does not exist, so the condition "!-f" should pass the request to Mongrel, but it seems to pass it to Apache, who doesn't find the file "state/list" and gives a 404 error, unless I'm reading the logs wrong! I wish I had detailed instructions on how to read a rewritelog and what the codes mean. I haven't been able to find them anywhere. The proxy modules are loaded, so there must be something else I'm not doing. I've been working on this for 2 weeks. Any suggestions will be appreciated! --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx