Apache配置v2ray方法
发布时间:
本文字数:152 字 阅读完需:约 1 分钟
配置 Apache
我们假设,你已经有了一个可以正常运行的V2Ray环境和Apache2。
1. 在服务器上开启以下 Apache 模组
sudo a2enmod ssl
sudo a2enmod proxy
sudo a2enmod proxy_wstunnel
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo a2enmod headers
2. 修改Apache 配置文件
我们找到配置文件,一般在 /etc/apache2 文件夹下。 一般,我们可以在该目录下找到sites-available(可用的配置文件) 和 sites-enabled(启用的配置文件) 我们进入 sites-enabled,找到 443(即 HTTPS 配置文件,例如:000-default-le-ssl.conf)。 把以下配置加到<VirtualHost></VirtualHost>
之间
<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>
Powerd by YlBlog(玉龙博客)