F
F
fman22016-11-03 21:19:54
linux
fman2, 2016-11-03 21:19:54

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

2 answer(s)
N
Ne-Lexa, 2016-11-03
@fman2

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 settings
nginx -s reload

F
fman2, 2016-11-03
@fman2

Understood. Just put the desired file in the conf.d folder

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question