Multiple indipendent sites on one lightsail instance

Keywords: LAMP/MAMP/WAMP - AWS - How to - Plugins installation/configuration

Description:
I have a lightsail system with a LAMP stack, I’m trying to get two independent sites with separate domains running on it.

1 instance:

  • domain_1
  • domain_2

neither website is in Wordpress

So far, I have set it up so that both domains point to the website, but for some reason, i can’t configure a second domain.

this is what I can run right now:

  ServerName domain_1.com
  ServerAlias *.domain_1.com
  SSLEngine on
  SSLCertificateFile "/opt/bitnami/apache/conf/bitnami/certs/domain_1.com.crt"
  SSLCertificateKeyFile "/opt/bitnami/apache/conf/bitnami/certs/domain_1.com.key"
  DocumentRoot /var/www/domain_1.com/public_html
  <Directory "/var/www/domain_1.com/public_html">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:80 _default_:80>
  ServerName domain_1.com
  ServerAlias *.domain_1.com
  DocumentRoot /var/www/domain_1.com/public_html
  <Directory "/var/www/domain_1.com/public_html">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>```

running this, both domains end up at the working domain_1 site.

I tried to then configure the second domain by adding this.

```<VirtualHost 127.0.0.1:443 _default_:443>
  ServerName domain_2.com
  ServerAlias *.domain_2.com
  SSLEngine on
  SSLCertificateFile "/opt/bitnami/apache/conf/bitnami/certs/domain_2.com.crt"
  SSLCertificateKeyFile "/opt/bitnami/apache/conf/bitnami/certs/domain_2.com.key"
  DocumentRoot /var/www/domain_1.com/public_html
  <Directory "/var/www/domain_1.com/public_html">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:80 _default_:80>
  ServerName domain_2.com
  ServerAlias *.domain_2.com
  DocumentRoot /var/www/domain_2.com/public_html
  <Directory "/var/www/domain_2.com/public_html">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>```

admittedly, I don't know if this would work, I'm fairly new to bitnami, but attempting to restart apache with this added crashes the instance, not entirely sure why. my best guess is that since I'm not running the Wordpress multisite thing I can't define multiple virtual hosts? but that seems incorrect... or perhaps declaring the server name multiple times? or perhaps that it isn't set up to use different encryption keys?

not sure, thanks in advance for the help!

UPDATE:

The issue seems to stem from the second website config.

Attempting to configure with only the second config fails.

The config for the second domain is identical except for domain _1 being replaced with domain _2

domain_1 config:

    <VirtualHost 127.0.0.1:443 _default_:443>

      ServerName domain_1.com

      ServerAlias *.domain_1.com

      SSLEngine on

      SSLCertificateFile "/opt/bitnami/apache/conf/bitnami/certs/domain_1.com.crt"

      SSLCertificateKeyFile "/opt/bitnami/apache/conf/bitnami/certs/domain_1.com.key"

      DocumentRoot /var/www/domain_1.com/public_html

      <Directory "/var/www/domain_1.com/public_html">

        Options -Indexes +FollowSymLinks -MultiViews

        AllowOverride All

        Require all granted

      </Directory>

    </VirtualHost>

    <VirtualHost 127.0.0.1:80 _default_:80>

      ServerName domain_1.com

      ServerAlias *.domain_1.com

      DocumentRoot /var/www/domain_1.com/public_html

      <Directory "/var/www/domain_1.com/public_html">

        Options -Indexes +FollowSymLinks -MultiViews

        AllowOverride All

        Require all granted

      </Directory>

    </VirtualHost>

Hello @exploring_randomly,

This is our guide to create a custom PHP app.
https://docs.bitnami.com/aws/infrastructure/lamp/administration/create-custom-application-php/

This is not an issue related to plugins, this is a technical issue. Please open a new ticket as Technical Issue instead of Bitnami Support Tool:

Screenshot 2021-07-16 at 10.05.30

Regards

thank you so much for your help!

I found the issue, it was due to an error in the keys and certificates.

Is it possible to close this topic?

Thank you!