Dns issue - Host Error 502 if typed www for virutal host website


#1

Hi Everyone,

I got 1 private IP and two virtual host website.
I can browse both the website but one website is HostError -

www.server-it.co.uk - https://www.server-it.co.uk works fine
www.yastech.com or https://www.yastech.com - Host Error but to my surprise if i type url as https://yastech.om or yastech.com in my browser it works fine.

I checked my virtual host file on apache and on cloudflare all settings are same.
I confused and scratching my head over two days.

any suggestion is highly appreciated. I am hosting the web on my personal webserver and all the virtual host settings are same for every site.

Listen 80
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName server-it.co.uk
ServerAlias www.server-it.co.uk
ServerAlias https://www.server-it.co.uk
ServerAlias https://server-it.co.uk
DocumentRoot /var/www/server-it.co.uk/public_html
ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName yastech.com
ServerAlias www.yastech.com
ServerAlias https://www.yastech.com
ServerAlias https://yastech.com
DocumentRoot /var/www/yastech.com/public_html
ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined

Should i try adding the host file in my host widows host file.
example.
127.0.0.1 localhost
127.0.1.1 guest-desktop
111.111.111.111 yastech.com
111.111.111.111 server-it.co.uk
111.111.111.111 www.yastech.com
111.111.111.111 www.server-it.co.uk

but how come www.server-it.co.uk is working without adding this entry in my windows host file?

Not sure what i am missing.
Please help.
Sal


#2

Issue resolved.

Hello I found the solution, my ssl was full in crypto section. changed to flexible and it works fine now.
but if anyone around to explain why we have to use flexible instead of full and why we have to use flexible for it work.

A detail explanation would definately help others please.
This issue gave me sever headache. trust me


#3

For full SSL to work. Your origin server needs to serve content on Port 443 with a valid SSL certificate (even a self signed one shall work for Full SSL but You need a Proper SSL e.g. letsencrypt or Comodo for Full Strict mode.)

What I see here is that you’re just serving content over port 80 which means that cloudflare can not establish contact with your server over port 443 and that’s why you’re getting 502 error.