NGIX 配置文件中 server_name 条目中的域名序列重要吗?

NGIX 配置文件中 server_name 条目中的域名序列重要吗?

当我更改行中的域名序列时,出现了不同的行为: 服务器名称 example.com custom.example.com;

顺序重要吗?当我改变序列。

     server { 
       listen   443 ssl http2;
       server_tokens off;
       server_name example.com custom.example.com;
       ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:AES256+EDH';
       ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
       ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
       location / { 
         # app1 reverse proxy follow
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-RemoteAddr $remote_addr;
         proxy_set_header Host $host;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass http://192.168.3.211:12000;
       }   
     }   


     server {
        listen       80 ;
        server_name  example.com custom.example.com;
        rewrite ^ https://$http_host$request_uri?  permanent;    
        server_tokens off;
      } 

当我更改序列时,我会收到一条 nginx 欢迎消息。一个证书用于主域和子域。

相关内容