gpt4 book ai didi

apache - 如何将 mod_proxy_wstunnel 添加到 Raspberry Pi 上的 Apache2 2.2(反向移植 mod_proxy_wstunnel)

转载 作者:行者123 更新时间:2023-12-03 04:41:21 25 4
gpt4 key购买 nike

Raspberry Pi 仍使用 Apache 2.2(目前为 2.2.22-13+deb7u4)。要使用 Apache 作为 Websockets 代理(“ProxyPass”),需要 Apache 模块 mod_proxy_wstunnel。

Apache 模块 mod_proxy_wstunnel 在 httpd 2.4.5 及更高版本中可用。

如何将 mod_proxy_wstunnel 添加到 Raspberry Pi 上的 Apache2 2.2(向后移植 mod_proxy_wstunnel)?

最佳答案

下载 Apache 源代码,从 Vitkin 添加补丁,编译 Apache 并将模块 mod_proxy_wstunnel.so 添加到 Apache 模块

有关补丁的详细信息:https://gist.github.com/vitkin/6661683

详细步骤:

# Check apache version (should be 2.2.22 as of writing, if not adjust the next step)
dpkg -s apache2

# Checkout apache source
svn checkout http://svn.apache.org/repos/asf/httpd/httpd/tags/2.2.22/ httpd-2.2.22

# Get patch and apply it
wget https://gist.github.com/vitkin/6661683/raw/873dd8b4de4ad1ff69757ffe48fc574374aedc57/apache-2.2-wstunnel.patch
cd httpd-2.2.22
patch -p1 -i ../apache-2.2-wstunnel.patch

# Build Apache
svn co http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x srclib/apr
svn co http://svn.apache.org/repos/asf/apr/apr-util/branches/1.3.x srclib/apr-util
./buildconf # EDIT: Some commenters noted that buildconf should be run before the configure
./configure --enable-proxy=shared --enable-proxy_wstunnel=shared
make

# Copy the module to apache installation
sudo cp modules/proxy/.libs/mod_proxy_wstunnel.so /usr/lib/apache2/modules

# Create module load file
cd /etc/apache2/mods-available
sudo echo "LoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.so" > proxy_wstunnel.load

# Create symbolic link to load the module
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/proxy_wstunnel.load proxy_wstunnel.load

# Add ProxyPass to Site config
cd /etc/apache2/sites-available

# e.g. modify default site config with "sudo nano default"
# and add the following line inside the VirtualHost element:
# "ProxyPass /websockets/mywebsocket ws://mywebsocketserver.com/websockets/mywebsocket"

# Restart Apache
sudo /etc/init.d/apache2 restart

关于apache - 如何将 mod_proxy_wstunnel 添加到 Raspberry Pi 上的 Apache2 2.2(反向移植 mod_proxy_wstunnel),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30443999/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com