Skip to main content

Overview

We use Nginx as the main web server in Cito. Each site has it’s main nginx configuration in /etc/nginx/conf.d/ - the file will end in .conf. Note there may also be *.conf.dist files in this directory- these are example files for specific apps (wordpress/laravel/magento etc) and are not active- by default nginx only parses .conf files. These are required and should not be removed. Redirects are stored in /etc/nginx/redirects/ - if making custom changes to redirects, you should store them in this file.
We recommend against making manual modifications to your nginx configuration files; these are automatically generated and managed by Cito, and so unmanaged changes can have undesirable consequences.

Making configuration changes

To validate your configuration change before applying it, run nginx -t. If there’s an error, nginx will warn you:
cito/etc/nginx/conf.d # nginx -t
nginx: [emerg] unknown directive "somethingwrong" in /etc/nginx/conf.d/broken.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
Or tell you the configuration is valid:
cito/etc/nginx/conf.d # nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
To reload nginx (without downtime), run systemctl reload nginx.

Custom HTTP headers

You can add custom HTTP headers via the Security page. This is useful if you want to set CORS, HSTS or similar headers without modifying Nginx configuration files manually.