Обновление Apache до версии 2.2 в Debian

(Debian, Ruby & Rails) · English (28,042 views)

Хорошие новости, парни! 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.

6 Responses to this entry

Subscribe to comments with RSS

said on 15.11.2006 at 22.40 · Permalink

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

said on 18.12.2006 at 11.49 · Permalink

Bigup on the mod_proxy_http thing as well…I was stumped too.

said on 18.12.2006 at 16.08 · Permalink

[...] 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. [...]

c a
said on 19.11.2008 at 17.56 · Permalink

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:

1
RewriteRule ^/(.*)$ balancer://YOURAPP%{REQUEST_URI} [P,QSA,L]
Greg
said on 20.01.2009 at 4.33 · Permalink

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 :)

Comments are closed

Comments for this entry are closed for a while. If you have anything to say – use a contact form. Thank you for your patience.