I need to create nginx.conf file with such routes: /assets - static files, /akka - for hello-world akka webapp, /* - default page. My default.conf file looks like this:
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
upstream hello-akka{
server localhost:9000;
}
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /akka {
proxy_pass http://hello-akka;
}
location /assets {
root /var/www;
}
}
}
Every time I restart nginx service I get these error messages:
nginx: [emerg] "worker_processes" directive is not allowed here in /etc/nginx/conf.d/default.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
I checked the structure of the file itself and I can't figure out what is wrong. Even when I delete this line I get the same "directive is not allowed" error but for other lines like pid, events and so on. So how can I fix such error?
Put that directive at the top of the /etc/nginx/nginx.conf
instead of /etc/nginx/conf.d/default.conf
.
The worker_processes
directive is valid only at the top level of the configuration.
Now it comes by default in /etc/nginx/nginx.conf
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With