Chinaunix首页 | 论坛 | 博客
  • 博客访问: 454857
  • 博文数量: 101
  • 博客积分: 1547
  • 博客等级: 上尉
  • 技术积分: 1072
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-12 23:46
个人简介

music,code,dialog,rest

文章分类

全部博文(101)

文章存档

2023年(8)

2022年(25)

2021年(6)

2020年(2)

2019年(6)

2018年(4)

2017年(5)

2016年(20)

2015年(4)

2014年(2)

2013年(1)

2012年(1)

2011年(1)

2010年(1)

2009年(2)

2007年(10)

2006年(3)

分类: 大数据

2023-06-25 09:19:43


简单而快速的方案是在vicuna前端增加一个nginx web 服务器,利用nginx reverse proxy的机制。
并启用简单的用户认证机制,就可以实现了,非常快速便捷高效。对于简单的demo非常实用。

相关的nginx配置如下:

点击(此处)折叠或打开

  1. upstream backend {
  2.         server 127.0.0.1:7860; # Replace with the actual WebSocket server address
  3. }

  4. server {
  5.         listen 80 default_server;
  6.         listen [::]:80 default_server;

  7.         # SSL configuration
  8.         #
  9.         # listen 443 ssl default_server;
  10.         # listen [::]:443 ssl default_server;
  11.         #
  12.         # Note: You should disable gzip for SSL traffic.
  13.         # See: https://bugs.debian.org/773332
  14.         #
  15.         # Read up on ssl_ciphers to ensure a secure configuration.
  16.         # See: https://bugs.debian.org/765782
  17.         #
  18.         # Self signed certs generated by the ssl-cert package
  19.         #

    点击(此处)折叠或打开

    1. server_name _;

    2.         location / {
    3.                 auth_basic "Restricted Access";
    4.                 auth_basic_user_file /etc/nginx/.htpasswd;
    5.                 proxy_pass http://localhost:7860;
    6.                 # First attempt to serve request as file, then
    7.                 # as directory, then fall back to displaying a 404.
    8.                 proxy_set_header Host $host;
    9.                 proxy_set_header X-Real-IP $remote_addr;
    10.                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    11.                 proxy_set_header X-Forwarded-Proto $scheme;
    12.                 try_files $uri $uri/ =404;
    13.         }

    点击(此处)折叠或打开

    1. location /theme.css {
    2.                 proxy_pass http://localhost:7860/theme.css;
    3.                 # First attempt to serve request as file, then
    4.                 # as directory, then fall back to displaying a 404.
    5.                 proxy_set_header Host $host;
    6.                 proxy_set_header X-Real-IP $remote_addr;
    7.                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    8.                 proxy_set_header X-Forwarded-Proto $scheme;
    9.         }

    点击(此处)折叠或打开

    1. location /assets/ {
    2.                 proxy_pass http://localhost:7860/assets/;
    3.                 # First attempt to serve request as file, then
    4.                 # as directory, then fall back to displaying a 404.
    5.                 proxy_set_header Host $host;
    6.                 proxy_set_header X-Real-IP $remote_addr;
    7.                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    8.                 proxy_set_header X-Forwarded-Proto $scheme;
    9.         }


    点击(此处)折叠或打开

    1. location /queue/join {
    2.                 proxy_pass http://backend/queue/join;
    3.                 proxy_http_version 1.1;
    4.                 proxy_set_header Upgrade $http_upgrade;
    5.                 proxy_set_header Connection "Upgrade";
    6.                 proxy_redirect off;
    7.         }




用hppasswd 指令生成用户名和密码, 存到 /etc/nginx/.htpasswd 文件中。

zentih
2023-06-25
阅读(329) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~