/etc/nginx/conf.d/nginx-basic.conf:1中不允许使用“ http”指令

时间:2018-11-21 18:59:08

标签: nginx kubernetes google-kubernetes-engine

我从日志中看到“ http”指令不允许错误。我已经在“ conf.d”文件夹中挂载了“ nginx-basic.conf”文件作为Kubernetes中的配置挂载。

nginx-basic.conf-

http {
  server {
    location / {
      proxy_pass 35.239.243.201:9200;
      proxy_redirect off;
    }
  }

}

我不确定这是怎么了。有人可以帮我指出吗?

1 个答案:

答案 0 :(得分:1)

您可能在基础Error: Filename specified with batch 中有另一个http指令,其中包含nginx.conf下的所有内容

例如(/etc/nginx/conf.d):

nginx.conf

您可以尝试删除user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; ... include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } 指令:

http