1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-19 15:08:02 +00:00

Add Check The Syntax Of nginx Files as a devops til.

This commit is contained in:
jbranchaud
2015-10-10 09:07:54 -05:00
parent 8dd641c0db
commit 4d88cfb7ec
2 changed files with 27 additions and 0 deletions

View File

@@ -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
```