Het volgende is een introductie tot de methode om te controleren of het nginx-configuratiebestand correct is; in nginx om het configuratiebestand te controleren, gebruik je voornamelijk het nginx-t-commando, ter referentie van vrienden die het nodig hebben.
Hoe te controlerennginx-configuratieKlopt dat? Gebruiknginx-T commando. 1. Verschillende commandoparameters van nginx Nginx wordt geïnstalleerd met slechts één programmabestand en biedt geen verschillende hypervisors op zichzelf; het gebruikt parameters en systeemsignaleringsmechanismen om het Nginx-proces zelf te besturen. De parameters van Nginx omvatten: Je kunt de /usr/local/nginx/sbin/nginx -parameter zo gebruiken -c<path_to_config>: Gebruik het opgegeven configuratiebestand in plaats van nginx.conf in de conf-map. -t: Test of het configuratiebestand correct is, dit commando is erg belangrijk wanneer je de configuratie tijdens runtime opnieuw moet laden, om te detecteren of het aangepaste configuratiebestand syntaxisfouten heeft. -v: Toont het nginx-versienummer. -V: Toont het versienummer van nginx samen met de compilatie-omgevingsinformatie en de parameters op het moment van compileren. 2. Het nieuwe conf-bestand detecteren Test of het huidige nginx.conf-bestand correct is, met het commando: [mw_shl_code=bash, waar] [root@localhost]/usr/local/nginx/conf# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful[/mw_shl_code]
Zo'n resultaat geeft aan dat het nieuwe conf-bestand foutloos is. Als er een fout is, geeft het aan welke lijn fout is gegaan en corrigeert het vervolgens de fout.
|