I set up two websites on my vps: one is http site example2.com, the other is https site example1.com:
Listen 80
Listen 443
<virtualhost *:443>
ServerName example1.com
DocumentRoot "/var/www/example1.com"
</virtualhost>
<virtualhost *:80>
ServerName example2.com
DocumentRoot "/var/www/example2.com"
</virtualhost>
Now if I visit http://example1.com, I actually open http://example2.com. How to stop this? I suppose http://example1.com is not accessible. I tried to add a default virtualhost hoping http://example1.com will open the file /var/www/default/index.html, but that did not help. http://example1.com always redirects to http://example2.com:
Listen 80
Listen 443
<virtualhost *>
DocumentRoot "/var/www/default"
</virtualhost>
<virtualhost *:443>
ServerName example1.com
DocumentRoot "/var/www/example1.com"
</virtualhost>
<virtualhost *:80>
ServerName example2.com
DocumentRoot "/var/www/example2.com"
</virtualhost>