赞
踩
由迷茫到全部完成只用了一个下午(扭曲,痛苦的心情),期间百度看各种博客,翻各种资料。
前期准备:
1.国外可以访问openai API 的服务器
2.必须有自己的域名(阿里云或腾讯云卖,或者找公司要)
2.SSL证书(阿里云有免费域名证书)
具体实现步骤:
1.安装nginx
2.配置nginx
3.服务器安装配置SSL证书
4.启动nginx,使用域名访问
nginx.conf 文件配置:
//nginx.conf 文件配置 (可以直接复制粘贴 Ctrl+A,Ctrl+V) user root; worker_processes auto; error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid; events { worker_connections 1024; } http { server { listen 80; server_name 配置好的域名; rewrite ^(.*)$ https://$host$1 permanent; } server { listen 443 ssl; server_name 配置好的域名; ssl_certificate 绝对路径下的ssl认证文件.pem; ssl_certificate_key 绝对路径下的ssl认证文件.key; ssl_session_cache shared:le_nginx_SSL:1m; ssl_session_timeout 1440m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5; location / { proxy_pass https://api.openai.com/; proxy_ssl_server_name on; proxy_set_header Host api.openai.com; proxy_set_header Connection ''; proxy_http_version 1.1; chunked_transfer_encoding off; proxy_buffering off; proxy_cache off; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。