windows10gegner
Goto Top

Nginx root directive not allowed

Hallo,
ich bin gerade dabei nginx einzurichten, um nen kleinen Webserver zu haben.
Dieser läuft auch, wenn man kein Verzeichnis definiert, wo die index.html liegt. Er ist dann normal erreichbar und zeigt die Seite, dass nichts konfiguriert ist. Die Index.html ist vorhanden. nginx läuft auf nem 32 bit Linux
Wo liegt jetzt an dieser Config der Hase im Pfeffer?
Ausgegeben wird, wenn ngingx als root starten soll:
nginx: [emerg] "root" directive is not allowed here in /etc/nginx/nginx.conf:5
Daraus schließe ich, dass es irgendwas mit root /srv/localhost; zu tun hat. Der Order und die html Dateien existieren.


LG Marco


  
user www-data;
worker_processes auto;
pid /run/nginx.pid;

root         /srv/localhost;

#location / {


events {
        worker_connections 768;
        # multi_accept on;
}

http {


        server {
        listen          80;
        server_name     10.0.0.115;
        index index.html;
        }



    sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

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


        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        gzip on;
        gzip_disable "msie6";  

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
include v.hosts/*.conf;
}

Content-Key: 351854

Url: https://administrator.de/contentid/351854

Printed on: April 23, 2024 at 18:04 o'clock

Member: SlainteMhath
SlainteMhath Oct 16, 2017 at 14:59:51 (UTC)
Goto Top
Moin,

ein einfacher Blick in die Doku hätte dir schon weitergeholfen...

lg,
Slainte
Member: Windows10Gegner
Windows10Gegner Oct 16, 2017 at 15:20:53 (UTC)
Goto Top
also ich steh grad aufm Schlauch. Was passt da nicht?
Member: LordGurke
LordGurke Oct 16, 2017 at 18:28:25 (UTC)
Goto Top
Da steht in welchen Kontexten die Direktive Gültigkeit entfaltet — wie hier z.B. nur innerhalb von „server“-, „http“- oder „location“-Klammern.
Da, wo es jetzt steht (nämlich im „core“-Kontext) ist die Direktive nicht existent.