栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在Apache mod_proxy_wstunnel后面使用go-websocket

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在Apache mod_proxy_wstunnel后面使用go-websocket

我在CentOS 7上的Apache 2.4.18之后使用Go安全WebSocket(wss://)服务器。以下是设置:

确保系统具有mod_proxy_wstunnel:

#查找/ usr / lib64 / httpd / modules / | grep ws

/usr/lib64/httpd/modules/mod_proxy_wstunnel.so

在00-proxy.conf中添加以下行:

#vim /etc/httpd/conf.modules.d/00-proxy.conf

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

重新启动Apache:

#systemctl重新启动httpd

检查设置:

#httpd -M | grep -iE’代理’

 proxy_module (shared) proxy_fcgi_module (shared) proxy_http_module (shared) proxy_wstunnel_module (shared)

编辑httpd-vhosts.conf:

#vim /etc/httpd/conf.d/httpd-vhosts.conf

<VirtualHost *:443>    ServerName go.mydomain.com:443    ProxyPreserveHost On    ProxyRequests off    SSLProxyEngine On    SSLCertificateFile "/etc/pki/tls/certs/mydomain.com/mydomain.crt"    SSLCertificateKeyFile "/etc/pki/tls/certs/mydomain.com/mydomain.key"    ### The configured ProxyPass and ProxyPassMatch rules are checked    ### in the order of configuration. The first rule that matches wins.    ProxyPassMatch ^/(ws(/.*)?)$ wss://192.168.0.1:443/$1    ProxyPass / https://192.168.0.1:443/    ProxyPassReverse / https://192.168.0.1:443/    ErrorLog "/var/log/httpd/go.mydomain.com-error_log"    CustomLog "/var/log/httpd/go.mydomain.com-access_log" common</VirtualHost><VirtualHost *:80>    ServerName go.mydomain.com:80    ProxyPreserveHost On    ProxyRequests off    ###    ProxyPassMatch ^/(ws(/.*)?)$ ws://192.168.0.1:80/$1    ProxyPass / http://192.168.0.1:80/    ProxyPassReverse / http://192.168.0.1:80/    ErrorLog "/var/log/httpd/go.mydomain.com-error_log"    CustomLog "/var/log/httpd/go.mydomain.com-access_log" common</VirtualHost>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/436165.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号