In this tutorial, you will learn how to install an Apache web server on a Raspberry Pi. I am using a Raspberry Pi 4, but any model should work.
By the end of this tutorial, you will have a basic Apache website running on your Raspberry Pi. Let’s get started.
1. Update Your System
First things first. Login to your Raspberry Pi via SSH and update your system.
sudo apt update sudo apt upgrade
2. Install the Apache Web Server
Use the apt package manger to install the Apache web server.
sudo apt install apache2
3. Create a Basic HTML Website
Note that the default Apache configuration file at /etc/apache2/sites-available/000-default.conf
has a web root directory of /var/www/html/
. Remove the index.html file in this directory, and create a new file with the following content.
<!DOCTYPE html> <html> <head> <title>Welcome to my Raspberry Pi!!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to my Raspberry Pi!!</h1> <p>Hello world. This website is being served from Apache on my Raspberry Pi.</a> <img src="Raspi-PGB001.png" width="500px"/> </body> </html>
Download the Raspberry Pi logo into the root directory of your website.
cd /var/www/html/ wget https://www.raspberrypi.org/app/uploads/2011/10/Raspi-PGB001.png
4. View the Website in a Browser
Don’t forget to change ownership of your website directory to the www-data user and group.
sudo chown www-data:www-data /var/www/html
To apply your changes, restart Apache with this command.
sudo systemctl restart apache2
Now you can open a web bowser, navigate to the IP address of your Raspberry Pi, and view your website that’s being served by Apache.

I’m not able move or copy files from another folder to /var/www/html folder, can you please help on this?
use sudo perms