Hey there,

I want to add a second domain like domain.com to a wordops site called landing.domain.com

I already tried to edit the sudo nano /etc/nginx/sites-available/landing.domain.com
and adding the second domain to the servers.

Reissued a ssl certificate with wo site update domain.com --le

This has not worked so far 🙁

Any help is really appreciated!
Thanks.

Not really sure what you want to achieve. You could add a site for domain.com as normal and redirect that to the subdomain site (you can just add it as a --html or --php site)? Does that do what you want?

In the DNS zone (I use cloudflare) you need to set the A and www records. Then example: sudo wo site create example.site.tld --wpfc --php81 --user=something --email=something@something.ltd -le --dns=dns_cf --hsts

Thanks,
I know I could do it before creating the site but I already have a working site landing.domain.com which I would like to use also for the domain.com domain.

I don't use cloudflare. I already set the A Record for domain.com to my wordops server. How can I adapt my working landing.domain.com to also accept requests from domain.com? Isn't there any solution without using cloudflare?

Thanks!

The way I would do it is as I described, using a redirect, because it's simpler and you're also not serving the same content at 2 different domains.
I forgot WordOps actually has an alias option for the redirect approach (not used it, but presumably will work main domain > subdomain too):
https://docs.wordops.net/commands/site/#alias-site

But yes you can do it without a redirect, it's just not a WordOps feature. You can edit the sites server block to serve both, e.g.:

server {
    server_name subdomain.domain.com domain.com;
    ...

I think you'll need a wildcard SSL on subdomain to also cover the root domain.
You may also want to adjust: /etc/nginx/conf.d/force-ssl-subdomain.domain.com.conf
Obviously you need to make sure your root domain has an A record pointing at the server too.

Tried the alias way as it looked very easy. Still my domain shows a ssl error (domain.com)
net::ERR_CERT_COMMON_NAME_INVALID

Here is the output from the Alias setup.
Where the site after "create" is my domain I want to add. and the "--alias" Domain is the site already existing in wordops (wordpress).

I also added the domain to the sites server list.
Will look into the nginx forcessl now.

A Record is set to the right server for the domain.

UPDATE: Also tried: "wo site update landing.domain.com -le --alias=domain.com
no luck so far, still ssl error and missing domain.com when accessing the site 🙁

    B-Hard Tried the alias way as it looked very easy. Still my domain shows a ssl error (domain.com)
    net::ERR_CERT_COMMON_NAME_INVALID

    It doesn't look like you created a certificate for the root domain.
    Try wo site update domain.com --letsencrypt
    (I'd guess creating an alias with cert is probably: wo site create site.tld --alias sitetoredirect.tld --letsencrypt)

    Here is the output of creating the alias. I deleted the site before I used the alias command with --letsencrypt.

    wo site create domain.com --alias landing.domain.com --letsencrypt
    Running pre-update checks       [OK]
    Setting up NGINX configuration  [Done]
    Setting up webroot              [Done]
    Testing Nginx configuration     [OK]
    Reloading Nginx                 [OK]
    Successfully created site http://domain.com
    Testing Nginx configuration     [OK]
    Reloading Nginx                 [OK]
    Successfully created site http://domain.com
    Certificate type : domain
    Validation mode : Webroot challenge
    Issuing SSL cert with acme.sh   [OK]
    Deploying SSL cert              [OK]
    Securing WordOps backend with current cert
    Adding HTTPS redirection        [OK]
    Testing Nginx configuration     [OK]
    Reloading Nginx                 [OK]
    Congratulations! Successfully Configured SSL on https://domain.com

    Still getting net::ERR_CERT_COMMON_NAME_INVALID errors when accessing the site 🙁

    Hosted by VirtuBox