---
title: Steering NGINX Test Config Before Screwing it Up
description: In NGINX test config before you deploy them by learning these tricks of the trade in this step-by-step tutorial.
canonical: https://adamtheautomator.com/nginx-test-config/
---

# Steering NGINX Test Config Before Screwing it Up

> In NGINX test config before you deploy them by learning these tricks of the trade in this step-by-step tutorial.

Source: https://adamtheautomator.com/nginx-test-config/

---

- Steering NGINX Test Config Before Screwing it Up Tap to hide Home

- Tutorials

- Guidebooks

- Instructors

- Get Paid to Write

- Advertising

- Recommended Resources

- About Adam

                Search for:

-

-

-

-

# Steering NGINX Test Config Before Screwing it Up

        Published:17 November 2021 - 1 min. read

- NGINX

          [](https://adamtheautomator.com/author/ravgeet-dhillon/)

            [Ravgeet Dhillon](https://adamtheautomator.com/author/ravgeet-dhillon/)

            Read [more tutorials](https://adamtheautomator.com/author/ravgeet-dhillon/) by Ravgeet Dhillon!

-

-

        [](https://specopssoft.com/product/specops-password-auditor/?utm_source=adamtheautomator&utm_medium=referral&utm_campaign=adamtheautomator_referral_na&utm_content=display)
        Audit Active Directory for stale users, weak passwords, and other security risks with [Specops Password Auditor](https://specopssoft.com/product/specops-password-auditor/?utm_source=adamtheautomator&utm_medium=referral&utm_campaign=adamtheautomator_referral_na&utm_content=text).

                XFacebookLinkedIn

We've all been there; you need to make "just this one little change" to your NGINX configuration and before you know it, your web server is down. Fortunately, there's an answer in NGINX test config changes!

There are several tasks you can perform to test config changes in NGINX with built-in switches, troubleshooting best practices, and testing permissions. In this tutorial, you're going to learn how to get started ensuring you never take production down again!

## Validating NGINX Configuration File Syntax

NGINX configuration files follow a specific schema. You can't just provide any text in a configuration file and expect NGINX to understand it. You need to test it's syntax first before releasing it into an important environment.

To test an NGINX config file, the nginx binary provides the -t switch. The -t switch is a flag that tells NGINX to read the config file (and all files referenced in the main config file) and ensure the syntax is valid.

sudo nginx -t

The -t switch not only tests syntax in the main NGINX test config file, but it also reads and tests syntax for all files referenced via an include statement also.

If the syntax of the configuration file is valid, you'll see the following:

 NGINX Configuration Test is Successful

On the contrary, you'll see below that if you've made a mistake in the config file, the -t switch will tell you.

 NGINX Configuration Error

If, for example, NGINX can't read an [included](http://nginx.org/en/docs/ngx_core_module.html#include) file in the config file due to a permission problem, you'll see the below output.

 Permissions Error in the Included file.

## Conclusion

You should now know how to use do NGINX test config file syntax! When you make a change to an NGINX config file, remember to always run the -t switch! And if you're using a [MAC](https://adamtheautomator.com/nginx-mac/), here's how to set up NGINX.

  Hate ads? Want to support the writer? Get many of our tutorials packaged as an ATA Guidebook.

  [Explore ATA Guidebooks](https://adamtheautomator.com/ata-guidebooks/)

## More from ATA Learning and Partners

- ### Recommended Resources! Recommended Resources for Training, Information Security, Automation, and more!

- ### Get Paid to Write! ATA Learning is always seeking instructors of all experience levels. Regardless if you’re a junior admin or system architect, you have something to share. Why not write on a platform with an existing audience and share your knowledge with the world?

- ### ATA Learning Guidebooks ATA Learning is known for its high-quality written tutorials in the form of blog posts. Support ATA Learning with ATA Guidebook PDF eBooks available offline and with no ads!

## Categories

- IT Ops

- Cloud

- DevOps

- Home Ops

- Information Security

- Software Development

## Site

- Home

- Tutorials

- Guidebooks

- Instructors

- Get Paid to Write

- Advertising

- Recommended Resources

- About Adam

        Copyright 2026&copy; ATA Learning | [Privacy Policy](https://adamtheautomator.com/privacy/)

                                                        Don't be left behind with the ATA Learning Newsletter!

Looks like you're offline!
