Answer the question
In order to leave comments, you need to log in
NGINX > what is the fastest way to change the port for all virtual hosts???
what is a quick way to change the port in the config for all virtual hosts??
there are sites and they are all on port 80, you need to transfer them to 8080. There are 10 sites, but if you change your fingers every time you break ... I just thought I never encountered it.
echo listen 8080; >> /etc/nginx/ports.conf??
server {
include /etc/nginx/ports.conf;
server_name yourdomain.com;
??
Answer the question
In order to leave comments, you need to log in
Manually change and save two versions of configs, when necessary, copy the necessary configs.
Roughly speaking, something like this:
awk '{gsub(/^listen[ \t]+.+$/, "listen 127.0.0.1:8080;");} 1' /path/to/nginx_server.conf
why constantly change the port? What is the task? Maybe we can suggest a better way to solve it.
If you change it one-time, then sed, as already said, if (why?) constantly change back and forth, then you just need to initially write the config with this in mind and use the voiced include functionality.
But I still doubt that there is really a need to constantly change the port.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question