WP + Let's Encrypt + NGINX + 1 IP + 2+ Websites

I created 2 separate instances of WP with 2 different domain names using the following command:

sudo ee site create domain1.com --wp --php7 --letsencrypt sudo ee site create domain2.com --wp --php7 --letsencrypt

Domain 1 works fine, redirects to https:// correctly and all but domain 2 gives me an error in FF:

The page isn’t redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

This problem can sometimes be caused by disabling or refusing to accept cookies.

my config files in sites-enabled: (I have two of these for each site, domain1 and domain2, in respective folders that are the same with exception to the domain fields.

server {

server_name domain1.com   www.domain1.com;


access_log /var/log/nginx/domain1.com.access.log rt_cache;
error_log /var/log/nginx/domain1.com.error.log;


root /var/www/domain1.com/htdocs;



index index.php index.html index.htm;


include common/php7.conf;

include common/wpcommon-php7.conf;
include common/locations-php7.conf;
include /var/www/domain1.com/conf/nginx/*.conf;

}

Here is my ssl.conf file (same as above, one for each domain…etc):

listen 443 ssl http2; ssl_certificate /etc/letsencrypt/live/domain1.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/domain1.com/privkey.pem;

What am i doing wrong? I have tried for hours to no avail with countless searches. Nginx.org states:

A more generic solution for running several HTTPS servers on a single IP address is TLS Server Name Indication extension (SNI, RFC 6066), which allows a browser to pass a requested server name during the SSL handshake and, therefore, the server will know which certificate it should use for the connection.

In order to use SNI in nginx, it must be supported in both the OpenSSL library with which the nginx binary has been built as well as the library to which it is being dynamically linked at run time. OpenSSL supports SNI since 0.9.8f version if it was built with config option “–enable-tlsext”. Since OpenSSL 0.9.8j this option is enabled by default. If nginx was built with SNI support, then nginx will show this when run with the “-V” switch:

$ nginx -V
...
TLS SNI support enabled
...

Which shows up in my case but its not working?

Thanks for the help in advance.

What’s your setting for domain2 in Worpress itself (i.e. is that set to https or http)?

It was set to https but I figured out a way to bypass this. I didn’t use ee but I just installed certbot for NGINX and automatically created a keys for each domain. Thanks for the reply