How To Raspberry Pi

How To: Host a Website Accessible over the Internet on Raspberry Pi

A Raspberry Pi 3b+

Do you want to host website on Raspberry Pi with a customised domain on a Raspberry Pi?
I did too, but couldn’t find any guide to do so, hence decided to write one myself.

We’ve covered earlier How To Install a WordPress on a Raspberry Pi, while the tutorial will allow you to install a website on Raspberry Pi. the site is only accessible on your local home network.

So if you want to show your friends your cool website filled with memes, you will need to do more.

In this tutorial we provide a comprehensive Step by Step instructions on how to create your first website on WordPress and make it accessible from Internet.

The Setup – The Software We Will Use

Unlike the earlier tutorial which explained how to install WordPress using Apache web server (using the LAMP Stack), we are going to use Nginx WebServer (using the LEMP stack).

LAMP vs LEMP
Battle of the WebServers!

Why LEMP is a better option for Raspberry Pi?

LEMP Stack To be used to host website on raspberry pi
LEMP Stack

LEMP is an open-source software stack which comprises of Linux, Nginx, MySQL, and PHP, the E stands for Nginx, go figure :).

Nginx vs Apache debate is wide-ranging that we will cover sometime in a future post, but for this exercise, we chose Nginx simply because while Apache can do a lot and has a lot of flexibility and features, Nginx has limited features but is extremely good at what it does. To use an analogy, Apache is a swiss army knife, while Nginx is a sharp cutting knife.

First Step is to Update Rasberry Pi software

12 comments

Nathan December 28, 2018 at 11:37 am

Seems to be working but I’m getting an error “413 Request Entity Too Large” when I upload a theme.

Reply
Rehan Haider December 28, 2018 at 3:50 pm

That is because both NGINX and PHP is has a maximum upload size, I think 20 MB. You should try this:
1. open php.ini by typing the following command
sudo nano /etc/php/7.0/fpm/php.ini

2. Scroll down till you find the following line “upload_max_filesize = 20M” and change it to “upload_max_filesize = 100M”

3. Scroll again till you find “post_max_size = 20M” and change it to “post_max_filesize = 100M”

4. Press Control + X, press Y and Enter to save.

5. open nginx.conf by typing
sudo nano /etc/nginx/nginx.conf

6. in the http section, add a line (also notice the semi-colon, php.ini has different syntax)
client_max_body_size 100M;

7. Press Control + X, press Y and Enter to save.

8 Restart the NGINX server by running the command
sudo service nginx restart

This should solve your problem

Reply
Nathan December 30, 2018 at 10:27 pm

I was changing the /etc/php/7.0/cli/php.ini, no wonder I was not able to get it to work.

Reply
Gaurav December 31, 2018 at 6:53 pm

I’m getting a”Error Establishing a Database Connection” error. How to fix?

Reply
Rehan Haider January 3, 2019 at 11:20 pm

Mate, can you recheck if the password that you are entering during the initial WordPress configuration is correct. If that doesn’t solve the problem, reach out to me on Twitter.

Reply
Vivek February 7, 2019 at 11:32 pm

Searched half the internet for a method to bypass carrier-grade NAT (CG-NAT) before finding your solution.

Although the auto-start causes occasional problems and doesn’t start.

Reply
backlinks September 7, 2020 at 2:36 am

backlinks

klmcadcpq oyrsx pmguqxm ykir scpzwhjxyvmegba

Reply
EatVerts September 17, 2020 at 9:20 pm

… [Trackback]

[…] Read More here to that Topic: techrad.io/how-to/1118/how-to-host-a-website-accessible-over-internet-on-raspberry-pi/ […]

Reply
UNICCSHOP.BAZAR September 18, 2020 at 7:17 am

… [Trackback]

[…] Find More to that Topic: techrad.io/how-to/1118/how-to-host-a-website-accessible-over-internet-on-raspberry-pi/ […]

Reply
game đánh bài ăn tiền thật trên điện thoại September 18, 2020 at 7:26 am

… [Trackback]

[…] Here you can find 66414 more Information on that Topic: techrad.io/how-to/1118/how-to-host-a-website-accessible-over-internet-on-raspberry-pi/ […]

Reply
bitcoin loophole September 18, 2020 at 3:57 pm

… [Trackback]

[…] Read More Information here to that Topic: techrad.io/how-to/1118/how-to-host-a-website-accessible-over-internet-on-raspberry-pi/ […]

Reply
Bitcoin Loophole Review September 20, 2020 at 11:02 am

… [Trackback]

[…] Find More Info here on that Topic: techrad.io/how-to/1118/how-to-host-a-website-accessible-over-internet-on-raspberry-pi/ […]

Reply

Leave a Comment