简单而快速的方案是在vicuna前端增加一个nginx web 服务器,利用nginx reverse proxy的机制。
并启用简单的用户认证机制,就可以实现了,非常快速便捷高效。对于简单的demo非常实用。
相关的nginx配置如下:
-
upstream backend {
-
server 127.0.0.1:7860; # Replace with the actual WebSocket server address
-
}
-
-
server {
-
listen 80 default_server;
-
listen [::]:80 default_server;
-
-
# SSL configuration
-
#
-
# listen 443 ssl default_server;
-
# listen [::]:443 ssl default_server;
-
#
-
# Note: You should disable gzip for SSL traffic.
-
# See: https://bugs.debian.org/773332
-
#
-
# Read up on ssl_ciphers to ensure a secure configuration.
-
# See: https://bugs.debian.org/765782
-
#
-
# Self signed certs generated by the ssl-cert package
-
#
-
server_name _;
-
-
location / {
-
auth_basic "Restricted Access";
-
auth_basic_user_file /etc/nginx/.htpasswd;
-
proxy_pass http://localhost:7860;
-
# First attempt to serve request as file, then
-
# as directory, then fall back to displaying a 404.
-
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;
-
try_files $uri $uri/ =404;
-
}
-
location /theme.css {
-
proxy_pass http://localhost:7860/theme.css;
-
# First attempt to serve request as file, then
-
# as directory, then fall back to displaying a 404.
-
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;
-
}
-
location /assets/ {
-
proxy_pass http://localhost:7860/assets/;
-
# First attempt to serve request as file, then
-
# as directory, then fall back to displaying a 404.
-
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;
-
}
-
location /queue/join {
-
proxy_pass http://backend/queue/join;
-
proxy_http_version 1.1;
-
proxy_set_header Upgrade $http_upgrade;
-
proxy_set_header Connection "Upgrade";
-
proxy_redirect off;
-
}
用hppasswd 指令生成用户名和密码, 存到 /etc/nginx/.htpasswd 文件中。
zentih
2023-06-25
阅读(329) | 评论(0) | 转发(0) |