This guide documents the process of turning a Raspberry Pi 4 into a web server accessible from within a LibreMesh mesh network. It is written for people with no prior experience using the Terminal or configuring network infrastructure. Every step is explained in plain language.
Go to raspberrypi.com/software and download the Raspberry Pi Imager for your operating system. Install it and open it. You will see three options: Device, Operating System, and Storage.
Insert your MicroSD card into your card reader and connect it to your laptop. It should appear as a drive on your computer.
Click Choose Device and select Raspberry Pi 4.
Click Choose OS. Select Raspberry Pi OS (other), then choose Raspberry Pi OS Lite (64-bit). This is a version without a graphical desktop: lighter, faster, and ideal for a server you will control remotely.
Click Choose Storage and select your MicroSD card. Be careful to select the right drive. Everything on it will be erased.
Before writing the image, click the Edit Settings button (it may look like a gear icon or appear after clicking Next). A panel will open with several tabs.
Under General, set:
myserver. This is how the Pi will identify itself on the networkpiAmsterdam or Rome) and keyboard layout (e.g. us)Under Services, make sure Enable SSH is turned on, and select Use password authentication.
Leave the Wi-Fi section empty. You will connect the Pi via ethernet cable.
Click Save.
Click Next, then confirm when asked if you want to write to the card. The Imager will download the operating system and write it to your SD card. This takes approximately 5–10 minutes depending on your internet connection and card speed.
When it finishes, a message will confirm the write was successful. Remove the SD card safely from your laptop.
Insert the MicroSD card into the Raspberry Pi. The card slot is on the underside of the board. Push it in gently until it clicks into place.
Connect one end of the ethernet cable to the Pi's ethernet port, and the other end to your laptop (using the adapter if needed).
Connect the USB-C power supply to the Pi. A small red LED will light up, followed by a green LED that will flicker as the system boots. Wait approximately 60–90 seconds for the Pi to fully start up.
Open the Terminal on your laptop. Type the following command and press Enter:
ssh pi@[your-hostname].local
Replace [your-hostname] with whatever hostname you chose in step 03.
The first time you connect, the Terminal will ask: "Are you sure you want to continue connecting?" Type yes and press Enter.
It will then ask for your password. Type the password you set in step 03. Note: as you type, nothing will appear on screen. This is normal for password entry in the Terminal. Press Enter when done.
If successful, the prompt will change to something like pi@myserver:~ $. This means you are now inside the Raspberry Pi, controlling it remotely from your laptop.
If the command returns an error like "Could not resolve hostname", the Pi may still be booting. Wait another 30 seconds and try again.
If it still does not work, you can find the Pi's IP address by checking your laptop's network settings. Look for a connection called "USB 10/100 LAN" or "Ethernet". The Pi should appear as the router or gateway address. Try: ssh pi@192.168.2.2 or ssh pi@192.168.1.1.
Once connected via SSH, run the following two commands one at a time. Each one may take several minutes:
sudo apt update
sudo apt upgrade -y
The word sudo means "run this as an administrator." The apt commands manage software packages. update downloads the list of available updates, and upgrade installs them. The -y flag automatically answers "yes" to any prompts.
When finished, the prompt will return. The Pi is now up to date.
Still connected via SSH, type:
sudo apt install nginx -y
This installs the Nginx web server on the Pi. It will also automatically start running in the background and will restart itself every time the Pi is turned on.
To confirm it is running, type:
sudo systemctl status nginx
You should see the word active (running) in green. Press q to exit this view.
Create a dedicated folder where your website files will be stored:
sudo mkdir -p /var/www/[your-website-name]
sudo chown pi:pi /var/www/[your-website-name]
The first command creates the folder. The -p flag creates any missing parent folders automatically. The second command changes the ownership of the folder to the user pi, which allows you to copy files into it later without permission errors.
Now tell Nginx where to find the website files. Type:
sudo nano /etc/nginx/sites-available/[your-website-name]
This opens a text editor called nano inside the Terminal. You will see a blank file. Type exactly the following:
server {
listen 80;
server_name _;
root /var/www/[your-website-name];
index landing.html index.html;
location / {
try_files $uri $uri/ =404;
}
}
To save: press Ctrl + X, then Y, then Enter.
This configuration file tells Nginx: listen on port 80 (the standard web port), serve files from the folder you just created, and use landing.html as the default page when someone visits the address.
Run these commands to activate the configuration and restart Nginx:
sudo ln -s /etc/nginx/sites-available/[your-website-name] /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginx
The first command creates a link to your configuration file in the "enabled" folder. Nginx only reads configurations that are enabled. The second removes the default placeholder page. The third checks your configuration for errors. The fourth restarts Nginx so it applies the new settings.
If nginx -t returns "syntax is ok" and "test is successful", everything is correct.
Before copying the website files, make sure the Pi's website folder is writable by your user. In the SSH Terminal, type:
sudo chown -R pi:pi /var/www/[your-website-name]
Then type exit to close the SSH connection and return to your laptop's own Terminal.
On your laptop's Terminal (not SSH; make sure the prompt shows your laptop's name, not [your-hostname]), navigate to where your website folder is and run the following command, replacing the path with the actual location of your site:
scp -r ~/path/to/your/website/* pi@[your-hostname].local:/var/www/[your-website-name]/
scp stands for Secure Copy. The -r flag copies entire folders recursively. The * means "everything inside this folder." The part after the colon is the destination path on the Pi.
You will be asked for the Pi's password. Type it and press Enter. You will see a list of files scrolling as they transfer. This may take several minutes depending on the size of your site.
After the transfer is complete, reconnect to the Pi via SSH:
ssh pi@[your-hostname].local
Then restore the correct permissions so Nginx can read the files:
sudo chown -R www-data:www-data /var/www/[your-website-name]
www-data is the user that Nginx runs as. By giving ownership to this user, you allow Nginx to access and serve all the files.
On your laptop, open a browser and type:
http://[your-hostname].local
Your website should appear. If you see it, the server is working correctly. If you see a "403 Forbidden" error, the permissions may not have been applied. Go back and repeat step 14. If you see "404 Not Found", check that your site has a file called landing.html or index.html at the top level of the folder.
Make sure your LibreMesh node is powered on and broadcasting its Wi-Fi network. The name will look something like LibreMesh.org/[your-network-name].
Connect to the Pi via SSH (while still connected via ethernet cable). Then run:
sudo rfkill unblock wifi
sudo nmcli radio wifi on
sudo nmcli dev wifi connect "LibreMesh.org/[your-network-name]"
Replace your-network-name with the actual name of your LibreMesh network. LibreMesh networks do not have a password by default, so no password is needed.
If the connection is successful, you will see: Device 'wlan0' successfully activated.
Once the Pi has joined the mesh, it will receive an IP address from the network. To find it, type:
ip addr show wlan0
Look for a line starting with inet followed by a number like [your-pi-ip]/16. This is the Pi's address on the LibreMesh network. Write it down.
From this point on, any device connected to the LibreMesh Wi-Fi can reach your server by typing this IP address in a browser. For example: http://[your-pi-ip]
The Pi can be connected to both the ethernet cable (to your laptop) and the LibreMesh Wi-Fi at the same time. This is useful during setup: you SSH via ethernet while the Pi joins the mesh via Wi-Fi. Once setup is complete, you can SSH into the Pi using its mesh IP address instead, while connected to the LibreMesh Wi-Fi yourself.
Instead of remembering a numeric IP address, you can give the server a name (like [your-network-name].mesh) that anyone on the network can type in their browser.
This is done by configuring the DNS (Domain Name System) on the LibreMesh node itself. Connect to your laptop's Terminal and SSH into the node:
ssh root@thisnode.info
If this is the first time you connect, it will ask you to confirm the host key. Type yes. If you get a "host key has changed" error (this happens after a reset), run: ssh-keygen -R thisnode.info and try again.
The node does not have a password by default. If asked, just press Enter.
Once inside the node, run these three commands, replacing the IP with the one you found in step 17:
uci add_list dhcp.@dnsmasq[0].address='/[your-network-name].mesh/[your-pi-ip]'
uci commit dhcp
/etc/init.d/dnsmasq restart
uci is the configuration tool used by OpenWrt and LibreMesh. The first command tells the node's DNS server to respond to the name [your-network-name].mesh with your Pi's IP address. The second saves the change permanently. The third restarts the DNS service so the change takes effect immediately.
Type exit to disconnect from the node.
On a phone or laptop connected to the LibreMesh Wi-Fi, open a browser and type:
http://[your-network-name].mesh
Your website should appear. If it does not, try disabling and re-enabling Wi-Fi on your device to force it to use the network's DNS. On iPhone, you can also try opening the address in a Private/Incognito browser window to avoid cached results.
Note: the address [your-network-name].mesh only works on devices connected to this specific LibreMesh network. It does not work on the regular internet. It exists only within the mesh.
Whenever you make changes to your website files on your laptop and want to update the server, connect your laptop to the LibreMesh Wi-Fi network, then open a Terminal and run:
First, restore write permissions so the files can be overwritten:
ssh pi@[your-pi-ip] "sudo chown -R pi:pi /var/www/[your-website-name]"
Then transfer the updated files:
scp -r ~/path/to/your/website/* pi@[your-pi-ip]:/var/www/[your-website-name]/
Finally, restore Nginx's read permissions:
ssh pi@[your-pi-ip] "sudo chown -R www-data:www-data /var/www/[your-website-name]"
Replace the IP address and folder path with your own values. After these three commands, the server will immediately serve the updated files.
If you are connected to the Pi directly via ethernet cable (not on the mesh), use [your-hostname].local instead of the IP address:
ssh pi@[your-hostname].local "sudo chown -R pi:pi /var/www/[your-website-name]"
scp -r ~/path/to/your/website/* pi@[your-hostname].local:/var/www/[your-website-name]/
ssh pi@[your-hostname].local "sudo chown -R www-data:www-data /var/www/[your-website-name]"
All three commands must be run in this order. Run them from your laptop's Terminal, not from inside an SSH session.
One common issue when uploading a website built on macOS to a Linux server is image file extensions. On macOS, photo.JPG and photo.jpg are treated as the same file. On Linux, they are different. If your HTML references photo.jpg but the file is named photo.JPG, the image will appear broken on the server.
To fix this, SSH into the Pi and run:
cd /var/www/[your-website-name]
find . -type f \( -iname "*.JPG" -o -iname "*.PNG" -o -iname "*.GIF" \) | while read f; do dir=$(dirname "$f"); base=$(basename "$f"); newbase=$(echo "$base" | sed 's/\.\([A-Za-z]*\)$/.\L\1/'); [ "$base" != "$newbase" ] && sudo mv "$f" "$dir/$newbase"; done
Then update all references in the HTML and CSS files:
sudo find . -type f \( -iname "*.html" -o -iname "*.css" \) -exec sed -i -e 's/\.JPG/\.jpg/g' -e 's/\.PNG/\.png/g' -e 's/\.GIF/\.gif/g' {} \;
Never unplug the Raspberry Pi without shutting it down first. Cutting power while the system is running can corrupt the SD card, potentially destroying the operating system and requiring a full reinstall.
To shut down safely, connect via SSH and type:
sudo shutdown -h now
Wait 10–15 seconds until the green LED on the Pi stops flickering and goes dark. Only then is it safe to disconnect the power cable.
Unlike the Raspberry Pi, LibreMesh router nodes do not require a software shutdown. They write data to flash memory in a way that is safe to interrupt. You can simply unplug the router directly.
"Raspberry Pi Documentation." Raspberry Pi Foundation. Accessed June 2026. raspberrypi.com/documentation.
"Nginx Beginner's Guide." Nginx. Accessed June 2026. nginx.org/en/docs/beginners_guide.html.
"LibreMesh Documentation." LibreMesh. Accessed June 2026. libremesh.org.
"UCI System." OpenWrt Documentation. Accessed June 2026. openwrt.org/docs/guide-user/base-system/uci.
"nmcli Reference Manual." NetworkManager. Accessed June 2026. networkmanager.dev.