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