当我访问没有 www 的 URL 时,nginx returns 404
nginx returns 404 when I visit the URL without www
访问时:www.fxmates.com/ => return 404
访问:https://fxmates.com/ => 确定
这是我的 Nginx 配置文件:
怎么了?
你的代码实际上有多个错误:
首先,在行中:
成功:
server_name fxmates.com www.fxmates.com;
另外,删除这一行:
这就是导致您的 nginx 网络服务器每次在用户访问 http://fxmates.com
上的 fxmates.com
上的任何页面时都向用户提供 404 页面的原因,因为在任何浏览器中,当您键入 fxmates.com
时,只有 https://
浏览器默认为 http://
然后 return 404
块将 404
推送到用户的浏览器。
当你在前面直接输入 https://
时,这不会影响你的原因是,nginx
在配置文件中使用了上面的 server block
。
希望对您有所帮助。
访问时:www.fxmates.com/ => return 404
访问:https://fxmates.com/ => 确定
这是我的 Nginx 配置文件:
怎么了?
你的代码实际上有多个错误:
首先,在行中:
成功:
server_name fxmates.com www.fxmates.com;
另外,删除这一行:
http://fxmates.com
上的 fxmates.com
上的任何页面时都向用户提供 404 页面的原因,因为在任何浏览器中,当您键入 fxmates.com
时,只有 https://
浏览器默认为 http://
然后 return 404
块将 404
推送到用户的浏览器。
当你在前面直接输入 https://
时,这不会影响你的原因是,nginx
在配置文件中使用了上面的 server block
。
希望对您有所帮助。