Both sides previous revisionPrevious revisionNext revision | Previous revision |
computing:apachesurvival [2022/07/15 04:57] – oemb1905 | computing:apachesurvival [2024/02/20 23:00] (current) – oemb1905 |
---|
This tutorial is for users of Debian GNU/Linux to set up a LAMP stack, TLS encryption, and a web-server which can serve two or more websites using apache's virtual hosts. I will also discuss how to set up basic protection on your firewall and a script that will make sure apache stays running and keep down time to a minimum. The first step is to create two content directories for each of the websites. Later, we will configure two virtual host configuration files in apache for each of these. Using site1.com and site2.com as an example, do the following and/pr adjust as needed: | This tutorial is for users of Debian GNU/Linux to set up a LAMP stack, TLS encryption, and a web-server which can serve two or more websites using apache's virtual hosts. I will also discuss how to set up basic protection on your firewall and a script that will make sure apache stays running and keep down time to a minimum. The first step is to create two content directories for each of the websites. Later, we will configure two virtual host configuration files in apache for each of these. Using site1.com and site2.com as an example, do the following and/pr adjust as needed: |
| |
sudo apt install apache2 php mariadb-server libapache2-mod-php | sudo apt install apache2 php mariadb-server |
sudo mkdir -p /var/www/site1.com/public_html | sudo mkdir -p /var/www/site1.com/public_html |
sudo mkdir -p /var/www/site2.com/public_html | sudo mkdir -p /var/www/site2.com/public_html |
Append something like this to the bottom: | Append something like this to the bottom: |
| |
xxx.xxx.xxx.xxx site1.com hostname | xxx.xxx.xxx.xxx site1.com site1 |
| |
Make sure to do this for each domain. Check your configurations up until now and then restart the service and check if it starts: | Make sure to do this for each domain. Check your configurations up until now and then restart the service and check if it starts: |
sudo a2ensite site2.com-ssl.conf | sudo a2ensite site2.com-ssl.conf |
| |
Visit both sites using Firefox, and ensure they resovle - if not, check each step and debug. Remember, you can trust the browser warning, because you set this cert up! However, for others to access your site, you need to use a trusted authority like Let's Encrypt. Here's how we do this: | Visit both sites using Firefox, and ensure they resolve - if not, check each step and debug. Remember, you can trust the browser warning, because you set this cert up! However, for others to access your site, you need to use a trusted authority like Let's Encrypt. Here's how we do this: |
| |
sudo apt install certbot letsencrypt python3-certbot-apache | sudo apt install certbot letsencrypt python3-certbot-apache |
This tutorial is a designated "Invariant Section" of the "Technotronic" section of Haack's Wiki as described on the [[https://wiki.haacksnetworking.org/doku.php?id=start|Start Page]]. | This tutorial is a designated "Invariant Section" of the "Technotronic" section of Haack's Wiki as described on the [[https://wiki.haacksnetworking.org/doku.php?id=start|Start Page]]. |
| |
--- //[[jonathan@haacksnetworking.org|oemb1905]] 2022/05/25 11:16// | --- //[[webmaster@haacksnetworking.org|oemb1905]] 2024/02/20 23:00// |