Хорошие новости, парни! Apache 2.2 уже в unstable. Я был очень удивлен, когда попытался сделать apt-get install apache2-utils, и он предложил мне удалить apache2 и установить заново :-) Я решил установить новую версию и потестировать rails с Apache2, mod_proxy_balancing и mongrel. В этой заметке я опишу мои приключения (или злоключения?)
Для начала, опишу мою текущую конфигурацию Apache 2.0: включен модуль SVN с auth_digest и rails с fcgid. Первым, что я увидел, была ошибка во время обновления:
1 | Starting web server (apache2)...Syntax error on line 32 of /etc/apache2/mods-enabled/dav_svn.conf: Invalid command "AuthUserFile", perhaps misspelled or defined by a module not included in the server configuration failed! invoke-rc.d: initscript apache2, action "start" failed. |
Черт! Директива была изменена в Apache 2.2, потому придется обновлять скрипты:
1 2 3 4 5 6 | AuthType Digest AuthName SVN AuthDigestDomain "/" AuthDigestProvider file AuthUserFile /var/www/svn/passwd AuthzSVNAccessFile /var/www/svn/authz |
Запустилось! Но как насчет rails? Вообще перестало работать. Вместо приложения я вижу содержание dispatch.fcgi! Похоже на то, что нет установленного модуля fastcgi, потому я попытался установить libapache2-mod-fcgid или libapache2-mod-fastcgi. Оба зависят от Apache 2.0! Похоже, нет другого способа запустить приложение, кроме как под Mongrel. Вот моя конфигураця:
1 2 3 4 5 6 7 8 9 10 11 12 13 | <Proxy balancer://appsite> BalancerMember http://localhost:3000 BalancerMember http://localhost:3001 </Proxy> <VirtualHost *:80> ServerName appsite.myhost.com ServerAdmin root@appsite.myhost.com Options Indexes FollowSymlinks RewriteEngine On ProxyPass / balancer://appsite/ ProxyPassReverse / balancer://appsite/ </VirtualHost> |
Обратите внимание, если url в ProxyPath заканчивается слешем, нужно, чтобы balancer также был со слешем в конце. Более того, в этом случае слеш в конце директивы BalancerMember не нужен, иначе Вы получите ошибку роутинга в Rails. Если в логах появилась ошибка “[warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.“, убедитесь, что Вы включили модули proxy, proxy_balancer и proxy_http.

Thanks! I’ve been trawling the internets for an hour trying to figure out that “No protocol handler was valid” error. I didn’t have mod_proxy_http enabled :) Good lookin out!
Cheers!
- Stephen
Bigup on the mod_proxy_http thing as well…I was stumped too.
[...] Not sure what to make of that, Google again came to the rescue with this helpful hint. It seems that by default Debian doesn’t include the proxy_balancer or proxy_http modules. I enabled them, restarted Apache, and everything was running smoothly. [...]
[...] blog.codahale.com kpumuk.info Bookmark [...]
Hello! thanks for fielding this. I came across this searching for the “No protocol handler was valid” error. Also note, if this didn’t solve you issue,… make sure your entry is correct:
Thanks about proxy_http. I had proxy_ajp, proxy, and proxy_balancer and for the life of me couldn’t figure out why it wasn’t working :)