apache rewrite rules, non-www, https

i think your first vritualhost config is acting as the default for any request on hosts not matching 'test1.com' and 'test2.test.eu'. Try adding this ServerAlias line to see if it gets the request going to the proper config file.

Rewrites in domain test2.test.eu config file:

ServerName test2.test.eu
ServerAlias www.test2.test.eu *.test2.test.eu
RewriteCond %{HTTP_HOST} ^www.test2.test.eu$ [NC]
RewriteRule ^(.*)$ https://www.test2.test.eu/$1 [R=301]

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https:// %{SERVER_NAME}%{REQUEST_URI}

This explicitly tells apache that requests to 'www.test2.test.eu' should be handled by this configuration. The second entry on the ServerAlias with asterisk provides a wildcard so that even if the request comes for 'wwww.test2.test.eu' or 'xxx.test2.test.eu', the proper apache config will handle it. With using the wildcard, you could actually leave off the first entry, like this:

ServerName test2.test.eu
ServerAlias *.test2.test.eu
RewriteCond %{HTTP_HOST} ^www.test2.test.eu$ [NC]
RewriteRule ^(.*)$ https://www.test2.test.eu/$1 [R=301]

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https:// %{SERVER_NAME}%{REQUEST_URI}  

and it should work the same, although your first rewrite won't catch non-'www' hostnames either way.