I created a new droplet lamp-ubuntu for myDomain.com, all works well with DocumentRoot as /var/www/html with a Let’s Encyrpt SSL certificate. I also have 000-default.conf and 000-default-le-ssl.conf config files in /etc/apache2/sites-available.
but I would like to make a few changes …
I want to add myDomain.net to the same droplet and I’ve organised my html files as follows
/var/www/html (keeping this the same while I make sure my changes work ok)
/var/www/html/myDomain.com
/var/www/html/myDomain.net
both with Let’s Encrypt SSL certificates.
can anyone advise what steps to take?
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!
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.
Heya @fingers,
Yes, sure. You just need to create another conf file in
/etc/apache2/sites-available
.First create the
/etc/apache2/sites-available/mydomain.net.conf
file. Inside you can put something like the following:That should be enough for now. Save the file. After that run
Now your Website if having the proper DNS record will start loading from your Droplet.
As for SSL, you can run the
certbot
command it will guide you through the proccess of installing an SSL certificate for your Domain and creating the proper virtual host for your 443 port.Hi there,
Would the second domain be loading a totally separate website? Or would it just need to show the content of your already existing website?
To add a second domain and a second website to your existing Droplet with Apache and Let’s Encrypt SSL certificates, follow these steps:
Prepare Your Directory Structure: Ensure your directories are structured as:
Create New Virtual Host Configuration Files: You’ll need to create new configuration files for both
myDomain.com
andmyDomain.net
.Create the Virtual Host for myDomain.com:
Add the following content:
Create the Virtual Host for myDomain.net:
Add the following content:
Enable the New Virtual Hosts:
Obtain SSL Certificates Using Let’s Encrypt: Use Certbot to obtain SSL certificates for both domains. If you don’t have Certbot installed, install it first:
Obtain and Install the Certificate for myDomain.com:
Obtain and Install the Certificate for myDomain.net:
Certbot will automatically configure your Apache virtual host files to use SSL. It will create corresponding SSL configuration files (e.g.,
myDomain.com-le-ssl.conf
andmyDomain.net-le-ssl.conf
) in/etc/apache2/sites-available
.Verify the SSL Configuration: Certbot should have reloaded Apache automatically, but it’s good to verify:
Let me know how it goes!
Best,
Bobby