Apache2

Reading Time: < 1 minute

Last Updates: 2/26/2022. This is still quick and dirty.

We are briefly going to touch on Apache2. And with a little luck sometime I will actually post some text in here.

sudo apt update
sudo apt install apache2

The following can be used to enable a “configuration” file for apache. The files for apache2 are store in /etc/apache2/sites-available A common site configuration file might have the “extension” of “.conf”. a2ensite is smart enough to treat wordpress and wordpress.conf the same.

sudo a2ensite wordpress

To enable the SSL module.

sudo a2enmod ssl

To reload the apache2 service.

sudo service apache2 reload

To disable a site.

sudo a2dissite 000-default

The config to enable SSL might look something like this. This can be added to the end of an existing config. This example is for a site named: wordpress. Please note the placement of the wp.crt and wp-privkey.pem files.

<VirtualHost *:443>
   DocumentRoot /srv/www/wordpress
   ServerName wp.my.lab
   ServerAlias wp.my.lab
   SSLEngine on
   SSLProtocol all -SSLv2 -SSLv3 -TLSV1
   SSLCertificateFile /etc/ssl/certs/wp.crt
   SSLCertificateKeyFile /etc/ssl/certs/wp-privkey.pem
   #LCertificateChainFile /var/www/letsencrypt/live/www.test.com/chain.pem
   <Directory /srv/www/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
   </Directory>
</VirtualHost>
This entry was posted in Linux. Bookmark the permalink.