mardi 2 mai 2017

www in domain not working - nginx

I'm having problems getting domains to work using nginx when you include www. in the url.

mydomain.com --> Working but www.mydomain.com --> Not Working

Config file:

server {
    listen 80;
    listen [::]:80;
    #server_name git.mydomain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 default_server ssl;
    listen [::]:443 default_server ssl;
    server_name git.www.mydomain.com;
    # certs sent to the client in SERVER HELLO are concatenated in ssl_certific$
    ssl_certificate /etc/nginx/ssl/mydomain.com.crt;
    ssl_certificate_key /etc/nginx/ssl/mydomain.com.key;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;

    # Diffie-Hellman parameter for DHE ciphersuites, recommended 4096 bits
    ssl_dhparam /etc/nginx/ssl/dhparam.pem;

    # modern configuration. tweak to your needs.
    ssl_protocols TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDH$
    ssl_prefer_server_ciphers on;

    # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
    add_header Strict-Transport-Security max-age=15768000;

    location / {
            try_files $uri $uri/ =404;
    }
}

Can you help me? Thank you!




Aucun commentaire:

Enregistrer un commentaire