Configure multiple sites (same domain, different port) on one Apache server:
===============================================================================
*This is for the ubuntu fork of apache2.
*Does not fix https currently
*Cant make sub domains yet. Just host domains.
*This would be a guide on to create the ubuntu mirror sub port, I will not show other ports for privicy, even though porcess would be very simaller.
1. Navagate to this directory:
cd /etc/apache2/sites-available/
and create old-ububtu.conf and add these contents with nano:
DocumentRoot /opt/RD/UNAS/.ubuntu_mirror/mirror/old-releases.ubuntu.com/ubuntu/
ServerName old-ubuntu.branden-g.ca
Options FollowSymLinks
ServerAlias old-ubuntu.branden-g.ca
*Save the file.
2. Edit the ports file by:
sudo nano /etc/apache2/ports.conf
and add "Listen 81" to its own line under 80.
and save the fie by ctrl+x
3. make sure directory permissions are set on the folder by:
sudo chmod -R 775 /opt/RD/UNAS/.ubuntu_mirror/mirror/old-releases.ubuntu.com/ubuntu/
sudo chown -R www-data:www-data /opt/RD/UNAS/.ubuntu_mirror/mirror/old-releases.ubuntu.com/ubuntu/
4. If directory is not under /var/www of your system, you must edit the /etc/apache2/apache2.conf file and insert this block under the existing one for /var/www using nano
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
*Save by Ctrl+X
5. enable site by:
sudo a2ensite old-ubuntu.conf
sudo a2enmod rewrite
6. Restart apache by:
sudo service apache2 restart
Done, you have a new apache site on another port!
can visit in your web browser by http://branden-g.ca:81
-------------------------------------------------------------------------------------------------------------------------
Sources:
https://opensource.com/article/18/3/configuring-multiple-web-sites-apache
https://superuser.com/questions/1412606/apache2-configure-two-websites-one-with-ip-port-one-with-domain
https://phoenixnap.com/kb/apache-403-forbidden
https://serverfault.com/questions/195611/how-do-i-redirect-subdomains-to-a-different-port-on-the-same-server#195831
https://www.howtogeek.com/devops/how-to-host-multiple-websites-with-one-apache-server/
https://ubuntu.com/tutorials/install-and-configure-wordpress#4-configure-apache-for-wordpress
Date: October 3rd 2023