Centos 安装NGINX 进行反向代理到ChatGpt服务器

浏览:744次阅读
没有评论

安装 Nginx

yum install -y nginx

创建 ChatGpt 配置项

vi /etc/nginx/conf.d/chat.conf

server {
    # 这里端口也可以非 80 或 443
    listen       80;
    # 这里写你的域名
    server_name 127.0.0.1;

    location / {
            # 代理的 nginx 目标地址
            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;
    }

}

将 127.0.0.1 替换为你的域名。

保存并退出配置文件。

验证

访问 Nginx 服务器,如果成功则会显示以下内容:

Centos 安装 NGINX 进行反向代理到 ChatGpt 服务器

正文完
 0
包子
版权声明:本站原创文章,由 包子 2023-05-26发表,共计506字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)