docker下nginx配置 proxy_set_header要报错

来源:1-8 配置 Nginx 端口代理与域名指向

icerainsnow

2018-04-02

#upstream blog {

  #server node:3000;

#}

server {

  listen 80;

  server_name 101.132.183.100;

  location / {

    proxy_pass http://node:3000;

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;

    proxy_set_header Host $http_host;

    proxy_set_header X-Nginx-Proxy true;

    proxy_redirect off;

  }

}


错误信息:

2018/04/02 08:33:55 [emerg] 1#1: invalid number of arguments in "proxy_set_header" directive in /etc/nginx/conf.d/default.conf:9

nginx: [emerg] invalid number of arguments in "proxy_set_header" directive in /etc/nginx/conf.d/default.conf:9


写回答

1回答

Scott

2018-04-03

试着把


proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;

    proxy_set_header Host $http_host;

    proxy_set_header X-Nginx-Proxy true;

    proxy_redirect off;



 都删掉,然后应该是正常的,再逐行加上面的代码,每加一行试一下,看能不能倒查出是哪一行的问题导致的

0
0

开发微信全家桶项目Vue/Node/MongoDB高级技术栈全覆盖

Nuxt/Vue SSR + Koa2 跨栈开发微信公众号+小程序

989 学习 · 401 问题

查看课程