2017-06-08 6 views
0

nginxのエラー(「HTTP」ディレクティブは、ここで許可されていないの/ etc/nginxの/ ABC /サイト対応)

nginxのサービスを開始する「HTTP」ディレクティブは、/ etcここで許可されていない間、私はエラーの下にgeetingています/ nginxの/ ABC /サイト対応:ここでは1

は私のABCコンフィグ

worker_processes 1; 
error_log /usr/local/openresty/nginx/logs/lua.log debug; 
events { 
    worker_connections 1024; 
} 
http { 
    upstream kibana { 
    server server1:30001; 
    server server2:30001; 
    keepalive 15; 
    } 
    server { 
    listen 8882; 
    location/{ 
     ssl_certificate /etc/pki/tls/certs/ELK-Stack.crt; 
     ssl_certificate_key /etc/pki/tls/private/ELK-Stack.key; 
     ssl_session_cache shared:SSL:10m; 
     auth_basic "Restricted Access"; 
     auth_basic_user_file /etc/nginx/htpasswd.users; 
     proxy_pass http://kibana; 
     proxy_redirect off; 
     proxy_buffering off; 
     proxy_http_version 1.1; 
     proxy_set_header Connection "Keep-Alive"; 
     proxy_set_header Proxy-Connection "Keep-Alive"; 
    } 
    } 
} 

される - > FYI私は/に/ etc/nginxの/サイト-利用可能で、このファイルを作成し、 にリンクしていますetc/nginx/sites-enabledがあります。私は、リンクが/ etc/nginxの/サイト対応のディレクトリに作成されていることがわかります上記のコマンドの後、次のコマンド

sudo ln -s /etc/nginx/sites-available/abc /etc/nginx/sites-enabled/abc 

を使用してリンクを提供しています。

私が間違っていることを提案してください。

よろしく VG

+0

'nginx'の設定ファイルは、'/etc/nginx/nginx.conf'と呼ばれます。 'sites-enabled'のファイルは、それに含まれるフラグメントです。 'http'セクションはメインコンフィギュレーションファイルにあります。あなたは' sites'ファイルに 'server'ブロックを置く必要があります。 –

+0

リチャードに感謝します。私のサイトでは、すべてを削除して、あなたが提案したとおりにサーバーブロックを配置しました。今度はサーバがproxy_pass http:// kibanaをブロックしてしまったので、サーバが定義されていないというエラーが表示されるので、上流のkibanaブロックをnginx.confに直接配置しました。このアプローチでは何のエラーも出ませんが、nginx IPを打つと何も得られませんでしたが、このサイトには到達できません。アップストリームブロックはnginx.confでサポートされていないようです。 – user3332404

答えて

0

HTTPディレクティブが属していないDOS。

すでにお持ちのngnix.conf HTTPディレクティブ

http { 
    ..config logs ... 
    inclide etc/ngnix/sites-enabled/*; <--- This Line include your files 
    .. more config... 
    server { 
     (..default server ...) 
     location/{ 
      index 
      root 
     } 
    } 
} 

では、あなたのサイト内のファイルがサーバーにのみ含まれている必要があります有効になって、HTTPディレクティブは主要な構成です。 私は試してみます:

events { 
    worker_connections 1024; 
} 

    upstream kibana { 
    server server1:30001; 
    server server2:30001; 
    keepalive 15; 
    } 

    error_log /usr/local/openresty/nginx/logs/lua.log debug; 

    listen 8882; 
    location/{ 
     basic "Restricted Access"; 
     auth_basic_user_file /etc/nginx/htpasswd.users; 
     proxy_pass http://kibana; 
     proxy_redirect off; 
     proxy_buffering off; 
     proxy_http_version 1.1; 
     proxy_set_header Connection "Keep-Alive"; 
     proxy_set_header Proxy-Connection "Keep-Alive"; 
    } 

    ssl_certificate /etc/pki/tls/certs/ELK-Stack.crt; 
    ssl_certificate_key /etc/pki/tls/private/ELK-Stack.key; 
    ssl_session_cache shared:SSL:10m; 

} 
+0

Zartchは私に理にかなっています、私はあなたが示唆したことを試しましたが、私のために働いていませんでした。ですから、include/etc/nginx/sites-enabled/*を追加しました。上記のようにnginx.confの中にあり、サイト内のabcファイルを編集することができます。そして再び私はavaialbleと有効にしました。今、 "worker_processes"指示は/ etc/nginx/sites-enabled/abc – user3332404

+0

で許可されていないので、worker_processes 1を削除しようとした場合、 worker_connectionは定義できません。私はssl_certificateを定義することができないと言っています。 – user3332404

+0

実際、ssl * paramsはserverディレクティブに属し、worker_connectionsはイベントに属します(しかし、私はそれについてはわかりません、私はuwsgi上のworkerを構成します)。 – Zartch

関連する問題