多种方法部署Pandora,让ChatGPT更好用【参考文档】
想到要部署,心情都是激动的,结果从周一开始部署,周一实现access_token登录版本,周二周三周四就在研究实现 xxx.xx?token=xxx的登录方式,一直卡在这!遇到请问,请到官方仓库寻找答案。相信你需要的其他人也会遇到。
pandora 项目地址
pandora WIKi 文档
pandora-讨论组 - 有疑问找不到答案一定要去看看
强调:在vps部署Pandora请使用国外主机,这样无论是电脑还是手机都可以使用GPT了,推荐:https://bbs.csdn.net/topics/610404063
注册账号,购买服务器就不多说了, 可以支付宝支付 还是比较人性化嘞!(有问题,私信)
1、安装docker环境(ubuntu系统)
apt update && apt install docker.io -y
2、拉取镜像
docker pull pengzhile/pandora
3、启动容器
(1)命令行模式:
docker run -it --rm pengzhile/pandora
(2)web模式
docker run -e PANDORA_CLOUD=cloud -e PANDORA_SERVER=0.0.0.0:8899 -p 8899:8899 -d pengzhile/pandora
用这种方法搭建,流畅使用GPT,任何终端的浏览器均可使用,安全、方便。
PANDORA_ACCESS_TOKEN
指定Access Token
字符串
docker run -d --name my-pandora-token --restart always -e PANDORA_SERVER=0.0.0.0:8899 -e PANDORA_ACCESS_TOKEN=xxxx -p 8899:8899 pengzhile/pandora
PANDORA_TOKENS_FILE
指定一个存放多Access Token
的文件路径
docker run -d --name my-pandora-tokens --restart always -e PANDORA_SERVER=0.0.0.0:8899 -e PANDORA_TOKENS_FILE=/home/access_token.json -p 8899:8899 -v /home/access_token.json:/home/access_token.json pengzhile/pandora
access_token.json内容如何,key自定义
{"key":"token"}
这样就可以通过xxx.com?token=key的方式访问
1、如果你使用的是nginx,编辑配置文件(记得在服务器安装一下nginx)
vim /etc/nginx/nginx.conf
将其内容替换为:
events {}
http {
server {
listen 80;
server_name fboth.pp.ua;
location / {
proxy_pass http://127.0.0.1:8899;
}
}
}
如果配置了SSL估计会遇到问题,具体看一下这个issue
nginx反代后开启ssl接口报错
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
proxy_headers_hash_bucket_size 1024;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# ----------HTTPS配置-----------
server {
# 监听HTTPS默认的443端口
listen 443 ssl;
# 配置自己项目的域名
server_name www.xxxxxx.com;
# 打开SSL加密传输
# ssl on;
# 输入域名后,首页文件所在的目录
root html;
# 配置首页的文件名
index index.html index.htm index.jsp index.ftl;
# 配置自己下载的数字证书
ssl_certificate cert/www.xxxx.cn.pem;
# 配置自己下载的服务器私钥
ssl_certificate_key cert/www.xxxx.cn.key;
# 停止通信时,加密会话的有效期,在该时间段内不需要重新交换密钥
ssl_session_timeout 5m;
# TLS握手时,服务器采用的密码套件
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
# 服务器支持的TLS版本
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# 开启由服务器决定采用的密码套件
ssl_prefer_server_ciphers on;
# location / {
# proxy_pass http://127.0.0.1:8899;
# # proxy_pass http://0.0.0.0:8899;
# }
location ^~ / {
proxy_pass http://127.0.0.1:8899/; # 将流量代理到 Pandora-Cloud 服务
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 REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header X-Cache $upstream_cache_status;
proxy_http_version 1.1;
}
}
# ---------HTTP请求转HTTPS-------------
server {
listen 80;
server_name www.xxxxx.cn;
# location / {
# proxy_pass http://127.0.0.1:8899;
# }
#rewrite ^(.*) https://www.xxxx.cn$1 permanent;
rewrite ^(.*)$ https://$host$1 permanent; # 强行将 http 转化 https 来访问。
}
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
#include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}