Answer the question
In order to leave comments, you need to log in
Where to place configs for virtual hosts in nginx?
I often see /etc/nginx/sites-available/
it in various nginx tutorials, but I haven’t seen anything like it myself. As I understand it, this was an old configuration in which files from /etc/nginx/sites-available/
were included in nginx.conf
.
At the moment I have two hosts and both configurations are registered in nginx.conf
.
I wanted to learn about best practice, where is it better to place configurations for hosts? how is it done by you?
Answer the question
In order to leave comments, you need to log in
On the subject: https://habrahabr.ru/company/oleg-bunin/blog/313666/
I have made the /etc/nginx/sites/ directory
and in nginx.comf
sites-available, sites-enabled is made in Debian-based distributions include sites/*.conf;
as I understood it was an old configuration in which files from /etc/nginx/sites-available/ were included in nginx.confThis is not an "old configuration", but (as already mentioned by the speaker above) - default settings for distributions derived from Debian (including Ubuntu and many others). The configuration is focused on hosting providers, so that it would be possible to conveniently "disable" the site, and not "completely delete" it (or its config).
For a long time, such configs migrated to a directory named /etc/nginx/conf.d/
You don’t need to store it anywhere
Store the config in sites-avaliable, and then sculpt the symlink to another directory - strange
Store it in nginx.conf if you are not afraid to lose configs sites when updating nginx
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question