侧边栏壁纸
博主头像
尘荞Joueur博主等级

行动起来,活在当下

  • 累计撰写 86 篇文章
  • 累计创建 42 个标签
  • 累计收到 163 条评论

目 录CONTENT

文章目录
VPS

HestiaCP面板反向代理其他网站设置

Administrator
2022-08-06 / 0 评论 / 5 点赞 / 297 阅读 / 2335 字

服务器推荐:

点击直达 腾讯云服务器
点击直达 海外服务器
点击直达 阿里云服务器

cd /home/用户名/conf/web/你新建的域名

vim nginx.ssl.conf
注释掉图中内容(注释用#号)

image-20220618122725389

如下图

img

在注释代码上方加以下代码(自行修改IP+端口号)

location / {
  proxy_pass http://IP:端口号/;
  rewrite ^/(.*)$ /$1 break;
  proxy_redirect off;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Upgrade-Insecure-Requests 1;
  proxy_set_header X-Forwarded-Proto https;
}

重新加载

nginx -s reload

如出现错误

nginx:[warn] cloud not build optimal proxy_headers_hash…

解决办法

编辑vim /etc/nginx/nginx.conf,在http里面增加

proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;

最后重新加载即可
nginx -s reload

5

评论区