diff --git a/README.md b/README.md index ff4ce21..7c4077d 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ smart people at [Hashrocket](http://hashrocket.com/). ### devops - [Check The Status of All Services](devops/check-the-status-of-all-services.md) +- [Check The Syntax Of nginx Files](devops/check-the-syntax-of-nginx-files.md) - [Push Non-master Branch To Heroku](devops/push-non-master-branch-to-heroku.md) - [Reload The nginx Configuration](devops/reload-the-nginx-configuration.md) - [Wipe A Heroku Postgres Database](devops/wipe-a-heroku-postgres-database.md) diff --git a/devops/check-the-syntax-of-nginx-files.md b/devops/check-the-syntax-of-nginx-files.md new file mode 100644 index 0000000..e7e3579 --- /dev/null +++ b/devops/check-the-syntax-of-nginx-files.md @@ -0,0 +1,26 @@ +# Check The Syntax Of nginx Files + +The syntax of [`nginx`](https://www.nginx.com/) configuration files can be a +bit finicky. On top of that, some `nginx` server commands can fail silently. +Get more confidence by using the following command to check for syntax +errors in those files: + +```bash +$ [sudo] nginx -t +``` + +If there is an error, you might see something like this: + +```bash +$ sudo nginx -t +nginx: [emerg] unexpected ";" in /etc/nginx/nginx.conf:16 +nginx: configuration file /etc/nginx/nginx.conf test failed +``` + +If all looks good, then you'll see this: + +```bash +$ sudo nginx -t +nginx: the configuration file /etc/nginx/nginx.conf syntax is ok +nginx: configuration file /etc/nginx/nginx.conf test is successful +```