0

I have an issue adding new subdomains via nginx - specifically all subdomains crash/get blocked when a subdomain beginning with the letter 'a' is added to our system. This is a server hosted on AWS EC2.

We have worked through a LOT of tech support with an AWS technician to rule out other issues, we were initially using LetsEncrypt for SSL and found out letsencrypt has a limit on subdomains.So, we bought an SSL certificate through another provider to rule that issue out. We have since been able to add around 6 other subdomains to our server. We have confirmed with the technician that our setup all looks ok otherwise. Not being able to add a subdomain beginning with the letter 'a' has stumped both them and us.

All subdomains have the same configuration settings in '/var/etc/nginx/sites-available' (apart from the subdomain name):


    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;
      }
    
    }

Additionally the nginx configuration is:

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/*;
}
RebRy
  • 11
  • 1
  • 6
  • Please post the output of `nginx -T` when the problem is occurring. – Michael Hampton Aug 25 '20 at 01:15
  • sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful – RebRy Aug 25 '20 at 01:29
  • That's not `nginx -T`. – Michael Hampton Aug 25 '20 at 01:49
  • sorry i copied across without caps. that was the output when nginx -T was used. – RebRy Aug 25 '20 at 01:59
  • Where is the rest of it? – Michael Hampton Aug 25 '20 at 02:05
  • The full output from nginx -T is stated in the above comment -or were you asking if there is more output? That is all i get! – RebRy Aug 25 '20 at 02:50
  • You should have _hundreds_ of lines of output frrom `nginx -T`. Please remove the snippets you have posted and replace it with the complete output. – Michael Hampton Aug 25 '20 at 02:57
  • ah - wait - sorry i had '-t' (minimal output). nginx -T lists every configuration file together, which is over 106, so that is too many lines to paste here. Anything i should be on the lookout for? – RebRy Aug 25 '20 at 03:07
  • Thanks Michael Hampton-- not solved yet but you've given me an idea where to look. I see that nginx -T ties together more information into the main nginx.conf part . I don't have a server up and running right now with this extra application with a subdomain beginning with 'a' . but i'll try that out and post my output if i can't solve it in a few days time. – RebRy Aug 25 '20 at 03:18

0 Answers0