Tenho um problema ao adicionar novos subdomínios via nginx - especificamente todos os subdomínios travam/são bloqueados quando um subdomínio começando com a letra 'a' é adicionado ao nosso sistema. Este é um servidor hospedado no AWS EC2.
Trabalhamos com MUITO suporte técnico com um técnico da AWS para descartar outros problemas, estávamos inicialmente usando LetsEncrypt para SSL e descobrimos que letsencrypt tem um limite de subdomínios. Então, compramos um certificado SSL de outro provedor para resolver esse problema fora. Desde então, conseguimos adicionar cerca de 6 outros subdomínios ao nosso servidor. Confirmamos com o técnico que nossa configuração parece correta. Não ser capaz de adicionar um subdomínio começando com a letra 'a' deixou eles e nós perplexos.
Todos os subdomínios têm as mesmas configurações em '/var/etc/nginx/sites-available' (além do nome do subdomínio):
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;
}
}
Além disso, a configuração do 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/*;
}