nginx: [emerg] ここでは 'server' ディレクティブは使用できません。

nginx: [emerg] ここでは 'server' ディレクティブは使用できません。

サーバーを構成しようとすると、次のエラーメッセージが表示されます。

[]# nginx -s reload
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/conf.d/hello-world.conf:1

構成は次のとおりです。

/etc/nginx/nginx.conf:

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

    index   index.html index.htm;

    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        server_name  localhost;
        root         /usr/share/nginx/html;
        location / {
        }
    }
}

/etc/nginx/conf.d/hello-world.conf:

server {
    listen 80;
    server_name my.server;

    root    i/var/www/hello-world;
    index   index.html;

    location / {
    }
}

nginx バージョン: nginx/1.6.2 オペレーティングシステム: CentOS-70-64-minimal

私はhello-world.confの内容をnginx.confにコピーしたときに働いたので、server内部の指示を選択していないようです。httpinclude

誰でも私を助けることができますか?

ベストアンサー1

おすすめ記事