Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6101

nginx reverse proxy won't start when using 301 redirects

$
0
0

(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.


Viewing all articles
Browse latest Browse all 6101

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>