nginx不会强制http到https

我有一个网站groupsitedev.com。 它不会强制网站httpd总是。 我已经完成了下面的设置,但仍然从http加载一些链接。 这里是configuration:

server { listen *:80 default_server; if ($scheme = http) { return 301 https://$host$request_uri; } } 

我试图只使用返回301,如果没有,这里是我得到错误的截图

https://www.dropbox.com/s/mqqdbmwl4vf43qp/error.JPG?dl=0

但仍然不会强制所有链接转移到https。

如果在Nginx块configuration中使用是不好的做法。

以下configuration会将所有请求redirect到https

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

您需要修复您的网站代码或configuration上的链接。

网站configuration可能有一个基本url的设置,你需要确保你有https

它没有这样的设置,那么你需要用/path/to/some/pic.jpg代替http://path/to/some/pic.jpg ,并且使用所使用的协议进行浏览器请求请求页面本身。

或者,如果资源来自不同的域,那么您可以用//example.com/path/to/some/pic.jpgreplace它。