开始
1. 安装Nginx-UI
# 很重要!!!!!!
# 导入github代理,不然下载速度非常慢
export GH_PROXY=https://ghproxy.cfd/
# nginx-ui安装
bash -c "$(curl -L https://cloud.nginxui.com/install.sh)"2. 安装nginx(ubuntu)
apt install nginx3. 设置nginx的配置文件
打开nginx的default的文件,进行编辑
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
# 如果你有证书,可以直接换成443,并且引用上证书。
listen 80;
listen [::]:80;
# 改成你的server
server_name <your_server_name>;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://127.0.0.1:9000/;
}
}然后执行
service nginx restart;