I want to configure the nginx config on the fly using lua. Tried to configure listen through the $ port variable. Did not work out. As I understand it, listen and server_name cannot be specified via a variable. Is there a way, even in theory, to specify listen through a variable?

  • Not. Not even in theory. Rather, in theory, you can write your nginx, but I'm afraid no one will appreciate - Alexey Ten
  • you can make a config so that the upstream is calculated depending on $ port - nörbörnën

0