如何使用Nginx将http(s)://(www。)example.comredirect到https://example.com?
正如标题所述。 我发现另一个有用的Q / A ,但它并没有显示如何在Nginx设置中正确地做到这一点,我的意思是parameters 。 他可能意味着https://exmaple.com在redirect到https://www.example.com之前应该有一个有效的握手。 在我的场景中, https:example.com效果很好,但https:example.com不能重新指向https://www.example.com 。 server { listen 80; server_name example.com www.example.com; rewrite ^ https://example.com$request_uri? permanent; } server { listen 443; server_name example.com; ssl on; # some other settings, correctly } 但是,当浏览http://example.com它被redirect到https://example.com但是它显示在chrome中 This site can't be reached example.com unexpectedly closed the connection. ERR_CONNECTION_CLOSED“` 我想redirect到https://example.com ,怎么样? – 更新 – /var/log/nginx/access.log显示 "GET […]