• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

nginx Basiskonfiguration

Chronos

Aktives Mitglied
Hallo alle =),

ich wollte mir interessehalber einen nginx-Server unter Windows installieren und bin nun dabei die Standardeinstellungen zu konfigurieren, scheitere aber schon relativ früh.
Ich arbeite nach dieser Anleitung: http://nginx.org/en/docs/beginners_guide.html
und bin im Abschnitt "Serving Static Content". Die Ordner habe ich angelegt, der nginx läuft auch.

Im Ordner "www" habe ich mir den Ordner "test" angelegt, doch sobald ich über
http://localhost/test/index.html versuche, meine dort abgelegte Seite aufzurufen, bekomme ich nur ein Not found vom nginx zurück.

http://localhost/index.html funtkioniert, und ist die Standard-Status-Seite vom nginx..

Meine nginx.conf-Datei sieht so aus:
Code:
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
   
        location / {
            root /data/www;
        }
       
        location /images/ {
            root /data;
        }     
    }
}

So dass ich, wie es auch in der Anleitung steht unter http://localhost/test/index.html
auf meine Seite kommen sollte.
PS: den Server neugestartet sowie die reload-Funktion habe ich bereits probiert.

Was mach ich denn falsch? Kennt ihr euch mit dem nginx aus?
 
Werbung:
hi, sieht mir eher so aus, dass die Docu für Linux gedacht ist. Wobei nginx unter "/" dann eigentlich "C:\" folgen sollte. Wo genau liegen denn bei dir die Ordner "www" und "data" ? Wahrscheinlich nicht direkt unter "C:\". Verwende am besten mal ne Windows-Pfadangabe. Versuchs vielleicht mal damit:

server {
listen 80;
server_name localhost;

index index.html;
root <Hier der Pfad zum Ordner mit deiner index.html>
}
 
Entschuldigung, dass ich so lang nicht geantwortet habe, die direkten Pfade wären so:

Code:
server {
        listen       80;
        server_name  localhost;
   
        location / {
            root E:\_tsp\_dev\web\nginx-1.5.12\data\www\test
        }
       
        location /images/ {
            root E:\_tsp\_dev\web\nginx-1.5.12\data\
        }     
    }

aber dann kommt nur eine Meldung mit einem unexpected "}" in der letzten Zeile von location.
 
Werbung:
cool, es kommt nun zwar erst mal kein Fehler mehr aber auf meine HTML-Seite kann ich noch nicht zugreifen:
http://localhost/test/index.html
(auch nicht als 127.0.0.1)

Code:
server {
        listen       80;
        server_name  localhost;
  
        location / {
            root E:\_tsp\_dev\web\nginx-1.5.12\data\www\test;
        }
      
        location /images/ {
            root E:\_tsp\_dev\web\nginx-1.5.12\data;
        }           
 }

PS: das ";" hatte dann noch gefehlt aber der Backslash war trotzdem zu viel.
 
Werbung:
Die erste Zeile betrifft noch den Stand als die .conf noch nicht stimmte:

Code:
2014/04/09 14:09:31 [error] 5716#4772: OpenEvent("Global\ngx_reload_6004") failed (2: FormatMessage() error:(15100))
2014/04/09 14:11:28 [notice] 3316#3960: signal process started
2014/04/09 14:11:31 [notice] 1560#3288: signal process started
2014/04/09 14:11:32 [notice] 4728#5012: signal process started
2014/04/09 14:11:33 [notice] 5528#6120: signal process started
2014/04/09 14:11:34 [notice] 4864#836: signal process started
2014/04/09 14:11:54 [crit] 2744#2688: *2 CreateFile() "E:\_tsp\_dev\web
ginx-1.5.12\data\www    est/test/index.html" failed (123: FormatMessage() error:(15100)), client: 127.0.0.1, server: localhost, request: "GET /test/index.html HTTP/1.1", host: "127.0.0.1"
2014/04/09 14:12:20 [crit] 2744#2688: *4 CreateFile() "E:\_tsp\_dev\web
ginx-1.5.12\data\www    est/www/test/index.html" failed (123: FormatMessage() error:(15105)), client: 127.0.0.1, server: localhost, request: "GET /www/test/index.html HTTP/1.1", host: "127.0.0.1"
2014/04/09 14:12:47 [crit] 2744#2688: *6 CreateFile() "E:\_tsp\_dev\web
ginx-1.5.12\data\www    est/data/www/test/index.html" failed (123: FormatMessage() error:(15105)), client: 127.0.0.1, server: localhost, request: "GET /data/www/test/index.html HTTP/1.1", host: "127.0.0.1"
2014/04/09 14:12:56 [crit] 2744#2688: *8 CreateFile() "E:\_tsp\_dev\web
ginx-1.5.12\data\www    est/data/www/test/index.html" failed (123: FormatMessage() error:(15105)), client: 127.0.0.1, server: localhost, request: "GET /data/www/test/index.html HTTP/1.1", host: "localhost"
2014/04/09 14:12:56 [crit] 2744#2688: *9 CreateFile() "E:\_tsp\_dev\web
ginx-1.5.12\data\www    est/favicon.ico" failed (123: FormatMessage() error:(15105)), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost"
2014/04/09 14:13:01 [notice] 4724#3684: signal process started
2014/04/09 14:13:50 [crit] 2744#2688: *11 CreateFile() "E:\_tsp\_dev\web
ginx-1.5.12\data\www    est/test/index.html" failed (123: FormatMessage() error:(15105)), client: 127.0.0.1, server: localhost, request: "GET /test/index.html HTTP/1.1", host: "localhost"
2014/04/09 14:13:50 [crit] 2744#2688: *12 CreateFile() "E:\_tsp\_dev\web
ginx-1.5.12\data\www    est/favicon.ico" failed (123: FormatMessage() error:(15105)), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost"
2014/04/09 14:14:38 [notice] 3388#5744: signal process started
 
Zurück
Oben