9

I'm trying to use a variable in nginx in server_name, but is not working. Is this possible?

server { listen 80; index index.php index.html; set $foo "bar.example.com"; server_name $foo; } 

2 Answers 2

8

No it's not possible unless you want to set it to exactly the $hostname variable.

Ref:

1

To set the server name in Nginx to the virtual machine name, you can use the built-in variable $hostname.

server { listen 443 ssl; server_name $hostname; } 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.