网上一大堆教程,但就是没有与网站共存的方法。有也是错误的。故此写一篇。
1,请先安装好V2ray,用官方的go.sh
2,复制如下内容到你的/etc/v2ray/config.json。
{
"log" : {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 28989,
"listen":"127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "a7373f7b-fa58-4eed-bda2-89f19c02c8b4",
"level": 1,
"alterId": 90
}
]
},
"streamSettings":{
"network":"ws",
"wsSettings":{
"path":"/ray"
}
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"outboundDetour": [
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
]
}
3,安装好apache,最新的。在你的/etc/httpd/conf.d/下创建以你网站命名的.conf文件。自己替换相应内容即可。或者复制如下内容。
<VirtualHost *:443>
DocumentRoot "/var/www/html/"
ServerName 90.life
ServerAlias www.90.life
DocumentRoot /var/www/html/
<Directory /var/www/html/>
AllowOverride All
</Directory>
SSLCertificateFile /etc/letsencrypt/live/90.life/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/90.life/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/90.life/chain.pem
SSLEngine On
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:28989/$1 [P,L]
SSLProxyEngine On
Proxypass /ray http://127.0.0.1:8989
ProxyPassReverse /ray http://127.0.0.1:28989
</VirtualHost>
4,后面的配置和其他正常一样。如果开启了selinux。请执行下这个
setsebool -P httpd_can_network_connect 1