http-to-https.conf 457 B

12345678910111213141516171819
  1. # Nginx UI Template Start
  2. name = "HTTP to HTTPS"
  3. author = "@0xJacky"
  4. description = { en = "HTTP force redirect to HTTPS Config", zh_CN = "HTTP 强制跳转 HTTPS 配置"}
  5. [variables.host]
  6. type = "string"
  7. name = { en = "Host", zh_CN = "主机"}
  8. value = ""
  9. # Nginx UI Template End
  10. {{- if .host }}
  11. if ($host == {{ .host }}) {
  12. return 308 https://$host$request_uri;
  13. }
  14. return 404;
  15. {{ else }}
  16. return 308 https://$host$request_uri;
  17. {{- end }}