nginx 上的子域名数量限制/字母问题

nginx 上的子域名数量限制/字母问题

我在通过 nginx 添加新子域时遇到问题 - 具体来说,当我们将以字母“a”开头的子域添加到我们的系统时,所有子域都会崩溃/被阻止。这是托管在 AWS EC2 上的服务器。

我们与 AWS 技术人员进行了大量的技术支持,以排除其他问题,我们最初使用 LetsEncrypt 进行 SSL,发现 letsencrypt 对子域名有限制。因此,我们通过另一家提供商购买了 SSL 证书以排除该问题。从那时起,我们就能够向我们的服务器添加大约 6 个其他子域名。我们已与技术人员确认,我们的设置一切正常。无法添加以字母“a”开头的子域名让他们和我们都感到困惑。

所有子域名在“/var/etc/nginx/sites-available”中都有相同的配置设置(子域名除外):


    upstream abc_app {
      server unix:///var/run/puma/abc_app.sock;
    }
    
    server {
      listen      80;
      server_name abc.domain.com.au www.abc.domain.com.au;
      return      301 https://abc.domain.com.au  ;
    }
    
    server {
      listen 443 ssl;
      server_name www.abc.domain.com.au;
      return      301 https://abc.domain.com.au  ;
    }
    
    server {
      listen 443 ssl;
      server_name  abc.domain.com.au;
      ssl on;
      ssl_certificate /etc/letsencrypt/live/setls.com.au/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/setls.com.au/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    
      location / {
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto https;
         proxy_set_header Host $http_host;
         proxy_redirect off;
         proxy_connect_timeout       6000;
         proxy_send_timeout          6000;
         proxy_read_timeout          6000;
         proxy_pass http://abc_app;
      }
    
      location ~ "^/assets/" {
        root /var/app/abc.domain.com.au/current/public;
        gzip_static on;
        expires max;
        add_header Cache-Control public;
      }
    
    }
    
    server {
      listen 80;
      server_name abc.domain.com www.abc.domain.com;
      return 301 https://abc.domain.com  ;
    }
    
    server {
      listen 443 ssl;
      server_name www.abc.domain.com;
      return      301 https://abc.domain.com  ;
    }
    
    server {
      listen 443 ssl;
      server_name  abc.domain.com;
      ssl on;
      ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    
      location / {
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto https;
         proxy_set_header Host $http_host;
         proxy_redirect off;
         proxy_connect_timeout       6000;
         proxy_send_timeout          6000;
         proxy_read_timeout          6000;
         proxy_pass http://arc_app;
      }
    
      location ~ "^/assets/" {
        root /var/app/abc.domain.com.au/current/public;
        gzip_static on;
        expires max;
        add_header Cache-Control public;
      }
    
    }

另外,nginx 配置是:

pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 1024;
        #worker_connections 768;
        # multi_accept on;
}

http {
        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        client_max_body_size 8m;

        # changed from 128 to 256 on 2018-12-22 by MM
         server_names_hash_bucket_size 256;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        # this is now taken care of in /etc/letsencrypt/options-ssl-nginx.conf
        #ssl_protocols TLSv1.1 TLSv1.2;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-available/*;
}

相关内容