Question

Wordpress problem after following some tutorials.

I followed this tutorial. How To Install WordPress with LEMP on Ubuntu 16.04(https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-16-04) - I also followed Prerequisites.

Wordpress site works well with letsencrypt.

But I want to add wordpress multisite with sub domain&domain mapping. exsisted wordpress example.com wordpress multisite sub-domain test.example.com domain mapping second.com

I tried How To Set Up WordPress Multisite with Nginx on Ubuntu 14.04 (https://www.digitalocean.com/community/tutorials/how-to-set-up-wordpress-multisite-with-nginx-on-ubuntu-14-04).

But I can’t access neither sub-domain nor domain-mapped domain. I can’t access test.example.com / and second.com redirected to example.com.

How can I set up Wordpress Multisite with exsisted wordpress site.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

I just solved with this.

@snowcat

If you use sub-domain mapping and want SSL for each mapped installation, you’d need to purchase a WildCard SSL Certificate for your main domain and install it. LetsEncrypt won’t work for WildCards.

Passing multiple domains to the LetsEncrypt script in this case, would not be the best option as this is something you’re going to have to do over and over again for each and every sub-domain you add as a site. That means if you add two sub-domains today, you have to run it. If you add two more tomorrow, same scenario.

@snowcat

You’ll need to setup a WildCard DNS A entry for sub-domains to map to your primary domain. If you look at the guide, you’ll see this:

server_name examplewp.com *.examplewp.com;

This tells NGINX to map all sub-domains to your main domain unless they actually resolve to another server block. This doesn’t, however, account for DNS.

You’ll need to add an A entry to your DNS zone file for the WildCard (i.e. *). That’d look like this:

A          *          DROPLET_IP

Where DROPLET_IP is your Droplets IPv4 IP. With those two things taken care of, you should be able to use anything.examplewp.com and it resolve to the main domain. If it happens to be mapped using WPMU, then WPMU should take over and map the correct WordPress site.

One other thing to note is that LetsEncrypt doesn’t support WildCard domains, so you can’t pass:

letsencrypt certonly -d examplewp.com -d *.examplewp.com

You have to pass resolvable domains and sub-domains, i.e.

letsencrypt certonly -d examplewp.com -d www.examplewp.com

This may be an issue since you’re wanting to use sub-domain mapping as the only way (right now) to get a WildCard SSL Certificate is to buy one. So without a WildCard SSL Certificate, each site would be HTTP only (not HTTPS/SSL/HTTP2).

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel