How to set FQDN instead of hostname?

Hey there,

Short question with example:

server {
listen 80;
server_name $hostname;
return 301 https://$hostname$request_uri;
}

$hostname only returns the plain hostname.

Is there also a variable for the full fqdn? (like returned by 'hostname -f')

server\_name (and redirect) should listen to fqdn.

And: No, hardcoding is not an option. 😉

1 thought on “How to set FQDN instead of hostname?”

Leave a Comment