Self-Hosting Guides  ->  The Basics

Install a Web Server

Checklist

Install nginx

The next thing you'll need to do is install a web server on your server so that you can host a website. There are many web servers to choose from, but for this guide we'll be using nginx, a popular open source web server that's simple and lightweight.

To install nginx, switch back to the terminal window you have open and connected to your Raspberry Pi and type the following command:

NOTE: Using sudo before a command allows you to run it as the root user, who has the necessary permissions to install software on your server.

sudo apt update && sudo apt install nginx

Install nginx

And that single command is all you need, nginx is now installed on your Raspberry Pi!

Test Your Web Server

Now that you have a web server installed, it's time to make sure it's working properly. Open a web browser on your local computer and type your server's IP address into the address bar.

If everything's working properly, you should see the default nginx welcome page.

nginx welcome page (local)


Web Server Installed

Congratulations, you've successfully installed a web server and can serve content locally on your network!

Next, we're going to replace the default nginx welcome page with our own content.