How to host multiple websites on Raspberry Pi 3/4?
3 min readHow to host multiple websites on Raspberry Pi 3/4?
How to host multiple websites on Raspberry Pi 3/4?
Many people know that Raspberry Pi can be used as web hosting server: just install apache or ngix packages, but need much time to learn how to configure it.
However, it’s very complex to configure if you want to host more than one website on Raspberry pi.
After long time exploring and tried almost all way, we will share the best and simple way to host multiple websites with free software on Raspberry Pi 3/4.
Hardware:
- Raspberry Pi: 3B, 3Bplus or 4B (4GB RAM recommended, but 1GB still works)
- MicroSD card: >16GB, Class 10, Endurance recommended.
- Ethernet cable: CAT6 or CAT5e
- Power supply: 5V/2.5A power supply for Raspberry Pi
OS: for Raspberry Pi
1. Download the image of Linux OS for Raspberry Pi
Below Linux OS are tested on Raspberry Pi, download the one you like:
- Raspberry Pi OS Lite: Download
- CentOS 8 STREAM: Download
- Ubuntu: Download
- Rocky Linux( CentOS8 clone): Download
This article will install CentOS 8 stream as example, others are similar.
2. Use balenaEtcher to write one image into the microSD card.
3. Afterwards put card into Raspberry PI‘s slot
4. Use ethernet cable to connect Raspberry Pi to one ethernet port on router or switch.
5. Power on Raspberry Pi by power supply.
6. Open your router manage UI on web browser
- find the IP the router assigned to Raspberry Pi
- Port 80 and 443 TCP forwarding to this IP
7. Download SSH client and connect to Raspberry Pi
- Download Putty SSH Client
- Input IP from router
- Set Port 22
- Click save , then click open
8. Login via putty SSH client
- user: root
- password: centos
9. Update centos by
dnf udpate
Afterwards you have completed to install update to date CentOS 8 stream on Raspberry Pi.
Control Panel for webhosting
The most popular control panel for webhosting severs is cPanel, very functionable panel for webhosting, but cPanel is not free.
We have tried almost all free replacement panel, but no one has close function to cPanel except aaPanel.
The install procedure is very simple and smooth, just one line command via SSH client.
aaPanel Requirements:
Memory:
512M or more, 768M or more is recommended (Pure panel for about 60M of system memory)
Hard disk:
More than 100M available hard disk space (Pure panel for about 20M disk space)
System:
CentOS 7.1+ (Ubuntu20, Debian10), to ensure that it is a clean operating system, there is no other environment with Apache/Nginx/php/MySQL installed (the existing environment can not be installed)
1) Linux Panel Installation Command
aaPanel is developed based on Centos, we recommend using Centos to install it
Centos :
yum install -y wget && wget -O install.sh http://www.aapanel.com/script/install_6.0_en.sh && bash install.sh forum
The experimental Centos/Ubuntu/Debian/Fedora installation command supports ipv6. Note that this command is executed with root privileges (Centos8 is supported)
curl -sSO http://www.aapanel.com/script/new_install_en.sh && bash new_install_en.sh forum
Ubuntu/Deepin :
wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && sudo bash install.sh forum
Debian :
wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && bash install.sh forum
2) Login infromation
After the installation is completed, the login information will appear on SSH client
Please remember below information and go to web browser to login into aaPanel
- Address: like 192.168.X.XXX:8888/xxxxxxx (don’t forget to copy the whole address)
- User name
- Password
3) Install software for ngix or apache server
After login in, aaPanel will let you choose to install ngix or apache server.
Due to the slow writing speed of MicroSD card, the installing will last tens minutes.
Then, below management UI will appear, you can add multiple websites afterwards.
4) Change time zone, hostname and adjust SWAP size
- Go to App store and install Linux Tools
- Click setting
- Configure
- DNS
- SWAP size
- Time Zone
- System Password
- IP setting
- RAM disk
Install “Linux Tools” from App Store
Linux Tools Setting
Now you can add your website on this Pi server and apply unlimited SSL certificates for your websites!
Don’t forget to point your domain to the public IP of your internet, statics IP recommended. (usually with extra fee)