V
V
v0384492017-03-20 22:03:32
linux
v038449, 2017-03-20 22:03:32

Sll does not work if you access the site via www, how to fix it?

ssl works if you go to eightrays.com but when you go to www.eightrays.com it says that this connection is not secure..

nginx config

user USSSER;
worker_processes 3;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 3072;
        multi_accept on;
}

http {


        #####################################
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";

        ##
        # Basic Settings
        ##

        sendfile on;

tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 128m;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

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

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;


        ##
        # 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 2;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;



        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;


        server {
                listen 80 default_server;
                listen [::]:80 default_server;
                server_name _;
                return 444;
        }

}


site config
server {

        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        server_name mysittte.com www.mysittte.com;

        ssl_certificate /etc/letsencrypt/live/mysittte.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/mysittte.com/privkey.pem;


    access_log /home/USSSER/mysittte.com/logs/access.log;
    error_log /home/USSSER/mysittte.com/logs/error.log;

    root /home/USSSER/mysittte.com/public/;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}

server {
    listen 80;
    listen [::]:80;
    server_name mysittte.com www.mysittte.com;

    return 301 https://$server_name$request_uri;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kuzin_val, 2017-03-21
@v038449

Some certificates are provided only for one domain, without subdomains, maybe you have one, especially if it's free. You need to get a certificate separately for www, or set up a redirect.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question