Updating and Maintaining PHP Sites on DigitalOcean

This document outlines the process to set up and maintain PHP websites on the DigitalOcean LAMP servers running Ubuntu. Included in this document is how to update systems and sites, as well as setting up virtual hosts properly as well as setting up SSL with Let’s Encrypt.

This document will be a living document, edited as necessary to keep the information current.

Update the Server

Dependencies are managed with apt-get. Upon logging in to the server, run apt-get update When the update completes, run apt-get dist-upgrade to update the server operating system and installed applications and services.

Adding a web site

Navigate to /var/www and create a folder for the new web site. Use chgrp -R www-data <foldername> to put the folder into the group owned by Apache.

Navigate to /etc/apache2/sites-available and add a virtual host file for the new site. Once the site configuration has been created, run a2ensite <site name> to enable the site. To disable the site, use a2dissite <site name>. Once the site is set up, use certbot to obtain and install SSL certificates for the new domain or subdomain.

Managing Domain Certificates the Easy Way

When adding a new certificate, you must provide certbot with a list of all of the domains in the existing certificate, otherwise certbot will remove those certificates. The easiest workaround is to create a bash file that contains the command with all of the domains, then simply add the new domain to the list and run the bash file.

certbot -d -d -d <etc>

After the domain is added, save the changes and run the file using sh <filename>.

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2024 WigeDev Portfolio | WordPress Theme: Annina Free by CrestaProject.