Apache-2.4

使用“upgrade=WebSocket”時Apache報錯“ProxyPass unknown Worker parameter”?

  • October 3, 2020

我正在嘗試根據這篇文章將 V2Ray 的 WebSocket 連接與 Apache 中繼,並且下面的程式碼片段之前工作過。

<LocationMatch "/{ws_path}}/">
   ProxyPass ws://127.0.0.1:{port}/{ws_path}/ upgrade=WebSocket
   ProxyAddHeaders Off
   ProxyPreserveHost On
   RequestHeader set Host %{HTTP_HOST}s
   RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
</LocationMatch>

但是現在我想在一台新機器上複製它,Apache2 無法啟動,並且錯誤消息說:

Jun 13 11:22:22 localhost apachectl[1519]: AH00526: Syntax error on line 32 of /etc/apache2/sites-enabled/whc2001cloud.tk.conf:
Jun 13 11:22:22 localhost apachectl[1519]: ProxyPass unknown Worker parameter
Jun 13 11:22:22 localhost apachectl[1519]: Action 'start' failed.
Jun 13 11:22:22 localhost apachectl[1519]: The Apache error log may have more information.
Jun 13 11:22:22 localhost systemd[1]: apache2.service: Control process exited, code=exited status=1
Jun 13 11:22:22 localhost systemd[1]: Failed to start The Apache HTTP Server.

如果我upgrade=WebSocket去掉參數,Apache2 啟動,但 V2Ray 無法正確連接。我已經啟用mod_ssl, mod_proxy, mod_proxy_wstunnel和其他相關模組。

*忘記發布答案而不是當時發表評論

只需刪除upgrade=WebSocket參數,它應該可以正常工作。

引用自:https://serverfault.com/questions/971262