我是NGINX的新手,我试图设置最少的工作。所以我想用nginx和supervisor运行aiohttp mini-app(例如this)。但我无法配置Nginx的权利,得到以下错误:nginx:[emerg]“http”指令在/ etc/nginx/sites-enabled/default中不允许:1
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是父指令。我做错了什么?
你说得对,'/ etc/nginx/nginx.conf'有这一行。我删除了'http'指令,现在得到“服务器指令不允许在这里”错误。没有完整配置的 – Paul
我不太确定。如果你想分享,那么我可以帮助更多。 –
好的,对不起,我只是不知道Nginx有多少个配置文件。它的主题是'sites-available/default.conf'的全部内容我应该向你展示哪些文件?只需要'/ etc/nginx/nginx.con'或其他东西? – Paul