私はNGINXの初心者で、最低限動作するものをセットアップしようとしています。そこで、私はnginxとsupervisorでaiohttpミニアプリケーションを実行しようとしています(この例による)。しかし、私はNginxを正しく設定することができず、以下のエラーが発生します。
nginx: [emerg] "http" directive is not allowed here in /etc/nginx/sites-enabled/default:1
以下はdefault.confファイルの全文です。
http {
upstream aiohttp {
# Unix domain servers
server unix:/tmp/example_1.sock fail_timeout=0;
server unix:/tmp/example_2.sock fail_timeout=0;
server unix:/tmp/example_3.sock fail_timeout=0;
server unix:/tmp/example_4.sock fail_timeout=0;
}
server {
listen 80;
client_max_body_size 4G;
server example.com;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://aiohttp;
}
}
}
正しく見えますね。serverディレクティブは
http` の中にあるべきものです。そして http は親ディレクティブです。何が間違っているのでしょうか?