【问题标题】:Configuring nginx cache post URL API FN Serverless配置 nginx 缓存 post URL API FN Serverless
【发布时间】:2018-01-30 17:49:03
【问题描述】:

我正在尝试配置 nginx 以缓存我的 api 发布结果,但还没有工作。 在我做的步骤下面: 1 - 我安装了 nginx 2 - 我创建配置文件: "worker_processes 1;

事件{

worker_connections 1024;

}

http {

proxy_cache_path  /var/cache/nginx/oracle-query levels=1:2 keys_zone=oracle-query:10m max_size=1g

             inactive=310s use_temp_path=off;



server {



    listen 80;



    root   /home/docker-nginx/html;

    index  index.html index.htm;



    server_name 172.17.0.1;



    location /oracle-query {

        auth_basic off;



        add_header Cache-Control "no-cache, must-revalidate, max-age=0";

        add_header X-Proxy-Cache $upstream_cache_status;



        proxy_cache oracle-query;

        proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504 http_404;

        proxy_cache_lock on;

        proxy_cache_valid any 600s;

        proxy_ignore_headers X-Accel-Expires Expires Cache-Control;



        proxy_pass http://172.17.0.1:8081/r/vivo-person/person;

    }



    location / {

            proxy_pass      http://172.17.0.1:8081;

        }



}

}" 3 - 我用这个配置启动了 nginx 缓存: sudo docker run --link fnserver:fnserver --name nginx-cache -p 80:80 -p 443:443 -v $PWD/nginx.conf:/home/vmfn/docker-nginx/nginx.conf:ro nginx 我的完成流程是 sudo fn apps config set vivo-person COMPLETER_BASE_URL "http://$DOCKER_LOCALHOST:8081"

没有 nginx 我的流程运行良好,但是当我将完成侦听器归因于端口 80 时,我也遇到了问题。

我需要一些帮助或教程来在我的 fn 中进行配置。

【问题讨论】:

    标签: docker nginx serverless fn


    【解决方案1】:

    我觉得

    proxy_pass http://172.17.0.1:8081/r/vivo-person/person;

    应该很可能是 proxy_pass http://172.17.0.1:8080/r/vivo-person/person;

    8080 是 fn 服务器端口(默认),8081 是流

    您似乎正在尝试缓存整个函数调用,因此您应该代理到 8080 (fnserver)

    【讨论】:

      猜你喜欢
      • 2013-05-22
      • 2022-10-07
      • 2020-10-13
      • 1970-01-01
      • 2015-02-15
      • 2018-03-04
      • 1970-01-01
      • 2017-04-01
      • 2010-12-08
      相关资源
      最近更新 更多