How do i check the syntax after changing the nginx configuration file?



  • Man page for nginx.

    This checks the /etc/nginx/conf.d/* files too.

         -t             Do not run, just test the configuration file.  nginx checks the configuration file
                        syntax and then tries to open files referenced in the configuration file.
    
        -T             Same as -t, but additionally dump configuration files to standard output.
    
    $ sudo nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    

    If your configuration file is not the default one:

         -c file        Use an alternative configuration file.
    
    $ sudo nginx -t -c /etc/nginx/mynginx.conf
    nginx: the configuration file /etc/nginx/mynginx.conf syntax is ok
    nginx: configuration file /etc/nginx/mynginx.conf test is successful
    

Log in to reply
 

© Lightnetics 2024