3

I have the following Nginx Block of code. Actually I have block of code around 50 time for different sites.

I wanted to see if I could combine it into one block of code. You will see test.dating in the code 5 times. Is there a way to replace the domain name 'test.dating' with a variable?

www.thai.dating

Just want to reduce the number of server blocks.

Cheers Adam

4
  • possible duplicate of Using variables in Nginx location rules Commented Aug 27, 2015 at 2:37
  • You want to combine all server blocks into one? Commented Aug 27, 2015 at 7:40
  • BTW, there must be no space between = and 404 in try_files. It should be try_files $uri =404; Commented Aug 27, 2015 at 7:41
  • nginx does not support variables in config files, as per nginx.org/en/docs/faq/variables_in_config.html Commented Nov 14, 2018 at 5:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.