2016-06-29 10 views
0

Hier ist meine NGINX Konfigurationsdatei:Mein NIGINX-Server ist ausgefallen. Wie starte ich es neu? Ich bin ziemlich neu in NGINX und CentOS

worker_processes 1; 
events { 
    worker_connections 1024; 
} 
http { 
    include  mime.types; 
    default_type application/octet-stream; 
    sendfile  on; 
    keepalive_timeout 65; 

    server { 
     listen  80; 
     server_name localhost; 
     location/{ 
      root /usr/share/nginx/html; 
      index index.html index.htm; 
     } 
     error_page 500 502 503 504 /50x.html; 
     location = /50x.html { 
      root html; 
     } 
    } 
} 

Als ich service nginx start in meinem Terminal eingeben, es zeigt:

Redirecting to /bin/systemctl start nginx.service 
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. 

Wenn ich ausführen systemctl status nginx.service es zeigt:

systemctl status nginx.service 
nginx.service - The nginx HTTP and reverse proxy server 
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) 
Active: failed (Result: exit-code) since Wed 2016-06-29 10:17:58 EDT; 10s ago 
Process: 21459 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE) 
Process: 21457 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) 
Main PID: 14307 (code=exited, status=0/SUCCESS) 

Jun 29 10:17:58 lotto systemd[1]: Starting The nginx HTTP and reverse proxy server... 
Jun 29 10:17:58 lotto nginx[21459]: nginx: [emerg] unexpected end of file, expecting "}" in /etc/ng...f:80 
Jun 29 10:17:58 lotto nginx[21459]: nginx: configuration file /etc/nginx/nginx.conf test failed 
Jun 29 10:17:58 lotto systemd[1]: nginx.service: control process exited, code=exited status=1 
Jun 29 10:17:58 lotto systemd[1]: Failed to start The nginx HTTP and reverse proxy server. 
Jun 29 10:17:58 lotto systemd[1]: Unit nginx.service entered failed state. 
Jun 29 10:17:58 lotto systemd[1]: nginx.service failed. 
Hint: Some lines were ellipsized, use -l to show in full. 

i install nginx in my remote server
aber ich einige Fehler in meiner nginx.conf-Datei durchgeführt und konnte, um wieder nicht in der Lage zu zurückkehren so versuchte es meine nginx zu entfernen und neu zu konfigurieren es so habe ich diese Stufe, die in der Verbindung gegeben ist mein nginx zu löschen http://www.ehowstuff.com/how-to-remove-uninstall-nginx-on-centos-7-rhel-7-oracle-linux-7/ then i use yum remove nginx and again reinstall it
aber wenn ich sudo systemctl start nginx or [[email protected] nginx]# service nginx start
seine zeigt

Job für nginx.service versuchen schlug fehl, da der Steuerprozess exitenter Code mit Fehlercode hereed. Siehe "systemctl status nginx.service" und "journalctl -xe" für Details. when i am using [[email protected] nginx]# systemctl status nginx.service showing

nginx.service - Der nginx HTTP-Server und Proxy Loaded kehren: geladene (/usr/lib/systemd/system/nginx.service; aktiviert; Vendor Preset: disabled) aktiv: fehlgeschlagen (Ergebnis: Exit-Code) seit Fr 2016-07-01 07:48:44 EDT; Vor 18s Prozess: 30832 ExecStartPre =/usr/sbin/nginx -t (code = beendet, status = 1/FAILURE) Prozess: 30830 ExecStartPre =/usr/bin/rm -f/run/nginx.pid (code = exited , Status = 0/Erfolg) Haupt-PID: 14307 (Code = beendet, Status = 0/Erfolg)

Jul 01 07:48:44 Lotto systemd [1]: Starten der Nginx HTTP und Reverse-Proxy-Server .. Jul 01 07:48:44 lotto nginx [30832]: nginx: [emerg] getpwnam ("nginx") fehlgeschlagen in /etc/nginx/nginx.conf:5 Jul 01 07:48:44 lotto nginx [30832] : nginx: Konfigurationsdatei /etc/nginx/nginx.conf Test fehlgeschlagen Jul 01 07:48:44 lotto systemd [1]: nginx.service: Steuerungsprozess beendet, code = exited status = 1 Jul 01 07:48: 44 lotto systemd [1]: Der nginx HTTP und Reverse Proxy Server konnte nicht gestartet werden. Jul 01 07:48:44 lotto systemd [1]: Einheit nginx.service trat fehlgeschlagen ein. Jul 01 07:48:44 lotto systemd [1]: nginx.service ist fehlgeschlagen. und [root @ Lotto nginx] # journalctl -XE

nginx.service - Die nginx HTTP und Reverse-Proxy-Server Loaded: geladene (/usr/lib/systemd/system/nginx.service; aktiviert; Vendor voreingestellt: deaktiviert) Aktiv: fehlgeschlagen (Ergebnis: exit-code) seit Freitag 2016-07-01 07:48:44 EDT; 18s her Prozess: 30832 ExecStartPre =/usr/sbin/nginx -t (Code = beendet, Status = 1/FAILURE) Prozess: 30830 ExecStartPre =/usr/bin/rm -f/run/nginx.pid (code = exited, status = 0/SUCCESS) Haupt-PID: 14307 (code = beendet, status = 0/SUCCESS)

+1

überprüfen Sie haben einen Fehler in Ihrer Nginx.conf-Datei. Können wir eine richtig formatierte Ansicht davon bekommen? – SArnab

+0

worker_processes 2; Fehlerprotokoll /var/log/nginx/error.log warn; pid /var/run/nginx.pid; Ereignisse { worker_connections 1024; } http { einschließlich \t /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$ remote_addr - $ remote_user [$ zeit_lokal] "$ anfrage"' '$ status $ body_bytes_sent "$ http_referer"' '"$ http_user_agent" "$ http_x_forwarded_for"'; Zugriffsprotokoll /var/log/nginx/access.log Haupt; –

+0

sendfile on; keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; Server { hören 80; Servername _; Standort/{ { root/usr/share/nginx/html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root/usr/teilen/nginx/html; } } } } –

Antwort

0

Der Fehler ist in Ihrer Konfigurationsdatei. Ich habe es versehentlich korrigiert, als ich deinen Post bearbeitet habe, weil ich dachte, du hättest es falsch kopiert. Diese Zeile Jun 29 10:17:58 lotto nginx[21459]: nginx: [emerg] unexpected end of file, expecting "}" in /etc/ng...f:80 sagt Ihnen genau was falsch ist. Wenn die Syntax nicht korrekt ist, wird der Dienst nicht gestartet.

Fügen Sie eine } an das Ende Ihrer nginx.conf Datei und es sollte funktionieren.

0

Wenn Sie Probleme haben, den nginx-Dienst zu starten, überprüfen Sie die Datei conf erneut. Sie können die Konfigurationsfehler mit dieser

nginx -t -c /etc/nginx/nginx.conf