Score:0

Multiple Sites with Multiple Subdomains Under apache2 (debian 10)

il flag

I am trying to run multiple WordPress websites, not all from the same domain, on my VPS. To be frank, while I know you can have multiple subdomains (of a single domain) running on apache2 (I've been doing it for the last couple of days :)), I'm not sure you can do both multiple domains and multiple subdomains.

Here's part of the /var/www/ directory structure I'm using:

/var/www/olbert.com/board/public_html/ /var/www/olbert.com/pursuit/public_html/ ... /var/www/jumpforjoysoftware.com/j4j/public_html

Olbert.com has 5 separate WordPress sites. JumpForJoySoftware as only one WordPress site, but I'm trying to set it up to support additional sites in the future.

Here are parts of the apache2 config files from /etc/apache2/sites-available. Please note I'm only showing you the "important" parts of the config files. There are additional files, one for each site, which define how to redirect from http to https.

First, board-le-ssl.conf:

<IfModule mod_ssl.c>

<VirtualHost *:443>
    ServerAdmin [email protected]
    ServerName board.olbert.com

    protocols h2 http/1.1

    DocumentRoot /var/www/olbert.com/board/public_html

Next, pursuit-le-ssl.conf:

<IfModule mod_ssl.c>

<VirtualHost *:443>
    ServerAdmin [email protected]
    ServerName pursuit.olbert.com

    DocumentRoot /var/www/olbert.com/pursuit/public_html

Finally, j4j.conf (which I haven't set up for https access yet):

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName jumpforjoysoftware.com
    ServerAlias www.jumpforjoysoftware.com

    DocumentRoot /var/www/jumpforjoysoftware.com/j4j/public_html

What's weird about the configuration's impact is this. I can surf to any of the subdomains on olbert.com (i.e., board.olbert.com, pursuit.olbert.com). The sites display correctly (after redirecting me to https://).

But when I try to surf to http://www.jumpforjoysoftware.com I end up at https://286chestnut.olbert.com. Which is bizarre.

I've ensured I've restarted the apache2 service before running tests (and no fatal errors are reported). I've also tried using a website that traces redirects, and it doesn't show any. I'm just being served the wrong pages.

Any advice or suggestions would be appreciated.

dave_thompson_085 avatar
jp flag
In addition to j4j being in sites-available do you have it _enabled_? If not, do you have a config for 286olbert that is alphabetically first in sites-enabled? If so it became your default vhost.
il flag
Yes, thanx, I had checked that. All the sites are enabled. FWIW I think the problem lies in how I defined the sub domains as server names when they should’ve been server aliases and Olbert.com, for example, should’ve been the server name. Sadly, my internet connection has failed and until it’s repaired I can’t test that theory.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.