Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 将除一个子域以外的所有子域重定向到https?_Linux_Redirect_Nginx_Https_Lets Encrypt - Fatal编程技术网

Linux 将除一个子域以外的所有子域重定向到https?

Linux 将除一个子域以外的所有子域重定向到https?,linux,redirect,nginx,https,lets-encrypt,Linux,Redirect,Nginx,Https,Lets Encrypt,该职位是非常接近我所寻找的。但我要找的是 letsencrypt.example.com should always be http *.example.com should always be https 使用post中的解决方案,我可以通过以下方式将所有http重写为https server { listen 80; server_name test.example.com; rewrite ^ https://$http_host$re

该职位是非常接近我所寻找的。但我要找的是

letsencrypt.example.com   should always be http
          *.example.com   should always be https
使用post中的解决方案,我可以通过以下方式将所有http重写为https

server {
  listen 80;
  server_name test.example.com;
  rewrite     ^   https://$http_host$request_uri? permanent;
}
然后再往前走

server {
  listen 443 ssl;
  ...
问题


但是如何确保
letsencrypt.example.com
保留在http端口80?

您应该为
letsencrypt.example.com
使用一个显式服务器,然后使用一个全包服务器进行重定向

您的端口80服务器块如下所示:

server {
    listen 80;
    server_name letsencrypt.example.com;
    ...
}
server {
    listen 80 default_server;
    return 301 https://$http_host$request_uri;
}
有关详细信息,请参阅