Question

Multiple Wordpress sites on a single droplet / One site is working, second gives White screen of death Why?

Posted July 26, 2020 181 views
ApacheWordPressLAMP StackLet's EncryptUbuntu 18.04

System information: LAMP installed on Ubuntu 18.04

I have two WordPress websites on Digital Ocean droplet, let’s say domain1 and domain2. I set up 2 virtual hosts. My domain2 located on /var/www/domain2 works fine but

domain1 is redirecting to /var/www/html instead of /var/www/domain1. Besides this, when I copy all files of domain1 to /var/www/html for testing purposes and hit to domain1, it’s giving white screen of death. *Additionally: * When I put a basic index.html file, it shows properly. But still, it shows the index.html file of /var/www/html

Let’s encrypt already installed for both domains.

Here the contents of relevant files:

/etc/apache2/sites-available/domain1.conf :

 UseCanonicalName On

<VirtualHost *:80>
        ServerAdmin domain1@gmail.com

        ServerName domain1.com
        ServerAlias www.domain1.com

        DocumentRoot /var/www/domain1

        <Directory /var/www/domain1/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain1.com [OR]
RewriteCond %{SERVER_NAME} =www.domain1.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>

/etc/apache2/sites-available/domain2.conf :

UseCanonicalName On

<VirtualHost *:80>
        ServerAdmin domain2@gmail.com

        ServerName domain2.co
        ServerAlias www.domain2.com

        DocumentRoot /var/www/domain2

        <Directory /var/www/domain2/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain2.com [OR]
RewriteCond %{SERVER_NAME} =www.domain2.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

There is a -le-ssl.conf file for domain2 (coming from let’s encrypt). Strangely there is no this kind of file for domain1. I copied and renamed and configured for domain1 but still no luck.

/etc/apache2/sites-available/domain2-le-ssl.conf:

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin domain2@gmail.com

        ServerName domain2.com
        ServerAlias www.domain2.com

        DocumentRoot /var/www/domain2

        <Directory /var/www/domain2/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/domain2/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain2/privkey.pem
</VirtualHost>
</IfModule>

Finally, .htaccess file which is the same for both of websites :

.htaccess:

# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I did these if you ask :

  • Restart apache after configurations
  • enabled the .conf files with a2ensite
  • dissabled the 000-default.conf file with a2dissite

Edit: Also, when I google http://my.ip.address it redirects to https://domain1.com with white screen.

Looking forward to your answers!

edited by MattIPv4

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.

×
1 answer

There are several missconfigurations. Is this still an active issue? If so I will move to my desktop and give you a hand.

Submit an Answer