Cover photo

Xray & aaPanelL组合科学上网!

操作系统:Debian 11 & Ubuntu 20.04

两个系统操作都差不多,没什么太大区别。如果有问题,我再特别标注。

宝塔国际版:

https://www.aapanel.com/new/index.html

X-UI:

https://github.com/FranzKafkaYu/x-ui#readme

CloudFlare:

https://www.cloudflare.com/zh-cn/

参考视频:

Play Video

1,准备linux.

此部份主要来源自这里,感谢原作者:

https://xtls.github.io/document/level-0/

apt update
apt upgrade
apt install sudo (这里Ubuntu默认自带,Debian11需要安装)

新增普通用户:

adduser XXX

添加sudo权限:
visudo

在 User Privilege Specification 下加入一行 即可。
XXX ALL=(ALL) NOPASSWD: ALL 

注意

我要特别说明的是NOPASSWD这个设置,它的意思是XXX用户临时使用root权限时,不用额外输入密码。这与一般的安全建议相反。我之所以如此推荐,是因为很多新人不顾危险坚持使用root账号就是因为用root时不用重复输入密码、觉得轻松。“两害相权取其轻”,我认为【直接用root用户的风险】大于【使用sudo 时不用输密码的风险】,所以做了以上的建议。

如果你希望遵守传统习惯、每次使用sudo时需要输入密码,那么这一行改成 vpsadmin ALL=(ALL:ALL) ALL 即可。

禁止root用户登陆:
nano /etc/ssh/sshd_config
找到PermitRootLogin Yes这一项,然后把它后面的设定值改为no即可
使用 ctrl+w 进入搜索模式,然后输入 PermitRootLogin 并回车

systemctl restart ssh

2,安装aaPanel

Ubuntu/Deepin
wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && sudo bash install.sh aapanel

Debian
wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && bash install.sh aapanel

https://www.aapanel.com/new/download.html#install

安装完以后添加域名解析到主机。

3,安装X-UI

bash <(curl -Ls https://raw.githubusercontent.com/FranzKafkaYu/x-ui/master/install.sh)

还有一个版本:

https://github.com/vaxilu/x-ui

配置入站,协议用vless。

修改nginx config

配置适用:一个博客网站,反代XUI面板,同时使用XRAY。

(需要修改1:/YYYYYY是XUI面板登陆的路径,端口12345是面板配置的端口)

(需要修改2:/XXXXXX是XUI入站配置的路径,端口35714是此入站配置的分配端口)

location ^~ /YYYYYY {
    proxy_pass http://127.0.0.1:12345/YYYYYY;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /XXXXXX {
        proxy_redirect off;
        proxy_pass http://127.0.0.1:35714;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        proxy_read_timeout 300s;
        # Show realip in v2ray access.log
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
post image

注意1,系统时间:

date -R

tzselect

亚洲 Asia,确认之后选择中国(China),最后选择北京(Beijing)

复制文件到/etc目录下

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

再次查看时间date -R,已经修改为北京时间

4,