2016-10-27 11 views
0

しかし、開始nginxのは失敗し、私のログには示しています。私は間違って何をやっているなぜnginxは起動に失敗しますか?

[emerg] 55#55: "server" directive is not allowed here in /etc/nginx/nginx.conf:1 

?それが重要かどうかは分かりませんが、これはドッカーのコンテナの中にあります。

+0

あなたの設定を見ずに言うことはできません...あなたのサーバーの指示に間違った場所で何か関係があります。 – Brad

答えて

1

/etc/nginx/nginx.confは、サーバーのセットアップを保存する場所ではありません。このファイルには、それが実行されるユーザーおよびその他のグローバル設定に関する情報が含まれている必要があります。通常、このようなものが含まれます:あなたは、個々のサーバーのセットアップを置くべき

user www-data; 
worker_processes 4; 
pid /run/nginx.pid; 

events { 
    worker_connections 768; 
} 

http { 
    sendfile on; 
    tcp_nopush on; 
    tcp_nodelay on; 
    keepalive_timeout 65; 
    types_hash_max_size 2048; 
    server_tokens off; 
    client_max_body_size 500M; 

    include /etc/nginx/mime.types;  
    default_type application/octet-stream; 

    access_log /var/log/nginx/access.log; 
    error_log /var/log/nginx/error.log; 

    gzip on; 
    gzip_disable "msie6"; 

    include /etc/nginx/conf.d/*.conf; 
    include /etc/nginx/sites-enabled/*; 
} 

は、/etc/nginx/sites-enabled/です。ご覧のとおり、そのフォルダ内のすべてのファイルは、nginx.confファイルのhttpブロックに含まれています。

投稿したサンプル設定を/etc/nginx/sites-enabled/some-random-name.confに保存し、nginx.confファイルを上記の設定に復元してください。

関連する問題