Welcome! Log In Create A New Profile

Advanced

"server" directive is not allowed here in /etc/nginx/nginx.conf:13

Posted by Chribo 
"server" directive is not allowed here in /etc/nginx/nginx.conf:13
July 15, 2014 05:56AM
Hello there,

I'm trying to set up an elasticsearch-Server based on an openSuSE-Appliance from here: https://susestudio.com/a/8ODadE/elastic-search-64-bit

I followed this tutorial to set up logstash and so on: https://www.digitalocean.com/community/tutorials/how-to-use-logstash-and-kibana-to-centralize-and-visualize-logs-on-ubuntu-14-04

Now I'm stuck on the NGINX-Setup and this is my current nginx.conf:

#
# Nginx proxy for Elasticsearch + Kibana
#
# In this setup, we are password protecting the saving of dashboards. You may
# wish to extend the password protection to all paths.
#
# Even though these paths are being called as the result of an ajax request, the
# browser will prompt for a username/password on the first request
#
# If you use this, you'll want to point config.js at http://FQDN:80/ instead of
# http://FQDN:9200
#
server {
listen *:80 ;

server_name elasticsearch.b4dom1.local;
access_log /var/www/kibana3;

location / {
root /usr/share/kibana3;
index index.html index.htm;
}

location ~ ^/_aliases$ {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
}
location ~ ^/.*/_aliases$ {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
}
location ~ ^/_nodes$ {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
}
location ~ ^/.*/_search$ {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
}
location ~ ^/.*/_mapping {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
}

# Password protected end points
location ~ ^/kibana-int/dashboard/.*$ {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
limit_except GET {
proxy_pass http://127.0.0.1:9200;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/kibana.myhost.org.htpasswd;
}
}
location ~ ^/kibana-int/temp.*$ {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
limit_except GET {
proxy_pass http://127.0.0.1:9200;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/kibana.myhost.org.htpasswd;
}
}
}


When I try to start the nginx-service I get the following error (I configure everything with YaST):

"/bin/systemctl start nginx.service returned 1 (unspecified error):"

So after some time on Google, I had a look into the Error-Log and found this:

"2014/07/15 09:41:43 [emerg] 1718#0: "server" directive is not allowed here in /etc/nginx/nginx.conf:13"

Is the account not allowed to write the file or something?
I'm kinda new to linux, but it looks like some entry in the config is wrong, isn't it?

I've done everything how the tutorial has shown.

Please let me know if I forgot some important information about my system, I'll then post it afterwards.


Regards,
Chribo
Re: "server" directive is not allowed here in /etc/nginx/nginx.conf:13
July 15, 2014 06:07AM
Take a look at the default example nginx.conf in the /conf folder.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: "server" directive is not allowed here in /etc/nginx/nginx.conf:13
July 15, 2014 07:30AM
I have no /conf folder, but I'm sure you're talking about the nginx.conf.default in /etc/nginx/

So, what exactly do you want me to look at?

I see that those two conf's are different - am I supposed to use the default one?
As I already said, I followed the tutorial and it had a different conf than the default one.
Re: "server" directive is not allowed here in /etc/nginx/nginx.conf:13
July 15, 2014 07:48AM
The sample conf has an events and http section, there is no jailtime for using your brain instead of just copy/pasting stuff.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 95
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready