Answer the question
In order to leave comments, you need to log in
How to work with multiple configs in the latest version of Nginx?
Good afternoon!
Tell me, please, in Apache there are sites-available/sites-enabled folders, so you can work with several configurations for sites separately (they are in different files).
I installed the latest version of nginx and I understand that it needs to store all configurations in only one file - default.conf. But what if there are 50 sites? Do not store configs in one file. One common config will not work either.
I'd like to add/remove configs on the fly using an SSH script I'll write, but I'd like one site - a separate config file. Does NGINX have this?
Answer the question
In order to leave comments, you need to log in
In nginx, everything is the same.
Create files in /etc/nginx/sites-available/ (depending on the distribution) according to the config for each site, for example site.ru.conf, to enable the site, go to the /etc/nginx/sites-enabled folder and make a symbolic link
Next, check the config for errors
and then reload the nginx settingsnginx -s reload
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question