V2ray手动安装和配置

前提条件 本文假设读者已经具备以下条件: 一台境外的vps,推荐BWG。 一个域名,无备案要求。先设置dns将域名解析到vps的ip。 为域名申请一个证书,可以从Let’s Encrypt获取免费证书;参考Caddy安装和配置。 V2ay服务端 校准时区 VMess 协议的认证基于时间,一定要保证服务器和客户端的系统时间相差要在 90 秒以内。 这里我们把时区设成上海 > timedatectl list-timezones | grep Shanghai Asia/Shanghai > timedatectl set-timezone Asia/Shanghai 服务端安装 bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) # /etc/systemd/system/v2ray.service [Unit] Description=V2Ray Service Documentation=https://www.v2fly.org/ After=network.target nss-lookup.target [Service] User=nobody CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE NoNewPrivileges=true ExecStart=/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json Restart=on-failure RestartPreventExitStatus=23 [Install] WantedBy=multi-user.target # /etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf # In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there....

2023-04-03 · (updated: 2023-05-02) · 3 min · TechLayman

Caddy安装和配置

安装前准备 go安装和环境配置 apt install wget software-properties-common apt-transport-https wget https://golang.google.cn/dl/go1.20.2.linux-amd64.tar.gz tar -zxvf go1.20.2.linux-amd64.tar.gz -C /usr/local/ nano ~/.bashrc export GO_HOME=/usr/local/go/ export GO_PATH=$HOME/go export PATH=${GO_HOME}/bin:$GO_PATH/bin:$PATH source ~/.bashrc #运行go进行测试 go version #改为国内加速地址 go env -w GOPROXY=https://goproxy.cn/,direct 安装Caddy 安装xcaddy,编译alidns插件。 apt install -y curl git jq apt install -y debian-keyring debian-archive-keyring apt-transport-https curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-xcaddy.list apt update apt install xcaddy xcaddy --help xcaddy build --output ....

2023-04-02 · (updated: 2023-07-26) · 3 min · TechLayman