I have the following configuration for my local Apache server:
<VirtualHost mysite.local:443>
ServerName mysite.local
SSLEngine on
SSLCertificateFile "/Users/graziano/Projects/mysite/ssl/mysite.local.pem"
SSLCertificateKeyFile "/Users/graziano/Projects/mysite/ssl/mysite.local-key.pem"
SSLProxyEngine On
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
<VirtualHost access.mysite.local:443>
ServerName access.mysite.local
DocumentRoot "/Users/graziano/Projects/mysite/mysite-backend"
SSLEngine on
SSLCertificateFile "/Users/graziano/Projects/mysite/ssl/access.mysite.local.pem"
SSLCertificateKeyFile "/Users/graziano/Projects/mysite/ssl/access.mysite.local-key.pem"
</VirtualHost>
Here's my hosts:
127.0.0.1 localhost
127.0.0.1 mysite.local
127.0.0.1 access.mysite.local
I've generated the certificate files using this fantastic tool.
When I visit https://mysite.local
, I'm correctly redirected to localhost:3000
(which serves a Next.js app), but if I hit https://access.mysite.local
(which is a Wordpress installation) Google Chrome complains that the connection is not secure:
NET::ERR_CERT_COMMON_NAME_INVALID
If I invert the two VirtualHost
directives, i.e. move the bottom one to the top and viceversa, then https://access.mysite.local
works but then https://mysite.local
doesn't and gives the same above error.
I need to make this work to test authentication cookies shared between the Next.js app and the Wordpress installation.