I have 6 domains in my vps server.In that 4 domains has letsencrypt ssl and two domains doesnt have ssl since client dont want.
for example ssl domain
for example non ssl domain
Here i have problem with alex.com .suppose if i access alex.com with https(https://alex.com ) then it will show john.com home page.
Can any one help me how to fix this
I am using centos7 and nginx server
john.com site available
server {
server_name john.com www.john.com ;
root /var/www/john.com/public;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
try_files $uri $uri/ /index.php$is_args$args;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
listen 80; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.john.com /fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.john.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
}
server {
if ($host = www.john.com ) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = john.com ) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name john.com www.john.com ;
return 404; # managed by Certbot
}