(very new to this all)I am trying to redirect www.example.com to example.com with this config:
server { listen 80; server_name www.example.com; return 301 https://$example.com$request_uri; } server { listen 80; listen [::]:80; server_name example.com; root /var/www/example.com/html; index index.html; }
This however, causes the nginx proxy to not work and return[emerg] unknown "example" variable
When commenting the return 301 https://$example.com$request_uri;
line, the proxy server starts just fine.
I don't know what to try since I can't find anyone who has had a similar problem.