Which location is better saving nginx.conf?

I have been working with nginx for some time and a little confused by multiple location where the nginx.conf scan be saved. I know the nginx.conf can be saved to 2 locations:

  1. /etc/nginx/sites-available/default
  2. /opt/nginx/conf/nginx.conf

Which location is better saving nginx.conf? Any difference with different location?

1

1 Answer

By default, the configuration file is named nginx.conf and placed in the directory /usr/local/nginx/conf, /etc/nginx (default for ubuntu), or /usr/local/etc/nginx. But you need to keep in mind that nginx can be installed in any directory, for example in the case of assembly from source. In you case - /opt/nginx/conf.

nginx.conf - general config of all server(it is possible to call it an entry point), there as a rule includes everything that placed in site-enabled and conf.d

conf.d - settings of individual parts or nginx modules, grouped for greater convenience.

site-available - configs of individual applications, services, sites and e.t.c. (the fact that they are here - does not mean that they will be included)

sites-enabled - here only enabled sites/apps/services. Here symlinks from site-available are added, in order to quickly enable or disable some config.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like