How To Raspberry Pi

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

A Raspberry Pi 3b+

Step 2 – Install and configure NGINX

We will now install NGINX, then test if it is working fine, and then finally check in the browser if it is able to render pages.

a) Install NGINX on Raspberry PI

sudo aptitude install nginx -y
Command to Install Nginx
Installing Nginx using Aptitude

b) Test NGINX Status

Run the below command to test NGINX status

sudo nginx -t
How To: Host a Website Accessible over the Internet on Raspberry Pi 1

Now we start NGINX, run the below commands one after the other, then pres Control + Z to exit

sudo service nginx start
sudo service nginx status
Command to start Nginx
Starting and test the status of NGINX

c) Check if NGINX can display pages in browser

You can open a new browser tab and type the URL “http://localhost” to see the default NGINX page.

NGINX Default page
Default NGINX page showing in browser
In Step 3 we will install PHP & it’s modules

6
Leave a Reply

avatar
3 Comment threads
3 Thread replies
3 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
VivekRehan HaiderGauravNathan Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Nathan
Guest
Nathan

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

Gaurav
Guest
Gaurav

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

Vivek
Guest
Vivek

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.