catalogs
2. Install Raspberry Pi OS with Raspberry Pi Imager
3. Setting up the Apache Web server
3.2 Installing a static sample site
3.3 Publishing web sites to the public network
3.5cpolar for token authentication
3.6 Generate cpolar random domain URLs
3.7 Generating cpolar second-level subdomains
3.8 Save parameters to the cpolar configuration file
3.9 Testing the modified configuration file
3.10 Configuring the cpolar service power-on self-starter
1. Overview
This is perfect for setting up your first website and learning not only to manage a wordpress site, but Linux as well.You will need a Raspberry Pi, a couple of hours and a computer to download the images. The Raspberry Pi is the perfect device for learning these things. Also check out the official RaspberryPi project site! Source.https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress2. Install Raspberry Pi OS with Raspberry Pi Imager
Download the Raspberry Pi Image Tool for your operating system. It supports most operating systems (Windows, Mac and Linux). Raspberry Pi OS – Raspberry Pi- Run and install the Raspberry Pi Image Tool
- Select Raspberry Pi OS -> Raspberry Pi OS (32-bit)
- Insert the SD card into the computer
- Click the Write button
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/28724f57f295f612b8273cc7694177cd.png)
3. Setting up the Apache Web server
Apache is a popular web server application that you can install on your Raspberry Pi to allow it to serve web pages. Apache itself can serve HTML files over HTTP. With add-on modules, it can serve dynamic web pages using scripting languages such as PHP.sudo apt-get install apache2 -y
sudo service apache2 restart
3.1 Testing the web site
By default, Apache places the test HTML file in the web folder, where you can view the page from your Pi or another computer on your network. Open the Apache default web page on the Raspberry Pi:- Open Chromium by selecting Internet > Chromium Web Browser from the menu.
- Enter the address http://localhost
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/df4834f3e66a63f76849159b42660298.png)
3.2 Installing a static sample site
To make sense of the site’s content, we deploy a simple static demo site – the Meditation Relaxation site.cd /var/www/html/
sudo rm *
sudo wget https://www.cpolar.com/static/downloads/meditation-app-master.tar.gz
sudo tar xzf meditation-app-master.tar.gz
sudo mv meditation-app-master/* .
sudo rm -rf meditation-app-master meditation-app-master.tar.gz
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/adabb41c240980aaad85014db76e322e.png)
3.3 Publishing web sites to the public network
Currently, this site can only be accessed on the LAN station, it is not accessible to public network users. In order for everyone to access the beautiful site you created, we need to do the following.3.4 Installing Cpolar
cpolar is an intranet penetration tool that exposes your intranet site to the public web so that everyone can access your site.- cpolar one-click installation script: (domestic users)
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
- or short link installation method: (foreign users)
curl -sL https://git.io/cpolar | sudo bash
- View cpolar version information
cpolar version
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/823ce06c0c79f39281c090e8d0c85a9b.png)
3.5cpolar for token authentication
If you don’t have a cpolar account yet, go to thecpolar Official websiteregister andlog inBackstage AccessAuthentication tokencpolar authtoken xxxxxxxxxxxxxxxxxx
3.6 Generate cpolar random domain URLs
cpolar http -region=cn_vip 80
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/7441073270a5985cad9dd8b46147b4b9.png)
- Let’s try this with an open browser: https://711d7522.vip.cpolar.cn
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/d965ea95c6ba882b5475bf0549e26050.png)
CTRL+C
key to exit cpolar
At this point, the public address is no longer accessible.
3.7 Generating cpolar second-level subdomains
Although it has been published to the public network, the domain name is randomly changing and is only suitable for temporary test use. If we want to use it for a long time, we have to configure a second-level subdomain. Operational Steps:- Upgrade to cpolar basic package
- Log in to the cpolar backend -> Reservations -> Reserve second level subdomains, e.g. add
dev9
Selection of regionsVIP China
as suffix city name, means prefecture or county (area administered by a prefecture level city or county level city)
cpolar http -subdomain=dev9 -region=cn_vip 80
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/91ab79e7b8b35882126f7556a8a741b9.png)
3.8 Save parameters to the cpolar configuration file
Just now we ran the cpolar program in the foreground, turned it off and the domain name disappeared, now we save the parameters to the configuration file. to support boot background self-start running.- Edit Configuration File
nano /usr/local/etc/cpolar/cpolar.yml
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/2c383937427e60557696b8b422396fd9.png)
authtoken: xxxxxxxxxxxx # Authentication token
tunnels:
ssh: # tunnel name for ssh, name can be customized
addr: 22 # port number 22
proto: tcp # Protocol tcp
region: cn_vip #region, cn_vip, optional:us,hk,cn,cn_vip
website: #Tunnel name, user-definable, but not repeatable for multiple tunnels.
addr: 8080 #local web site port
proto: http # Protocol http
region: cn_vip #region, cn_vip, optional: us,hk,cn,cn_vip
- Setting the website tunnel’s default
8080
The port is modified to80
- Add a line
subdomain: "Your second-level subdomain"
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/15fb87e632e0cda9c07eacaf3dcc3fc1.png)
yaml
formatted, indentation-sensitive, and there can be noTAB key
。
and then pressCTRL+X
, exit, prompting you to save or not, answerY
, confirming the save file path.enter (computer key)
3.9 Testing the modified configuration file
Start all tunnel tests in the foregroundcpolar start-all
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/29f62719169c243a94063008de119bcb.png)
3.10 Configuring the cpolar service power-on self-starter
- Configure cpolar to boot up
sudo systemctl enable cpolar
- Daemon mode, start cpolar
sudo systemctl start cpolar
- View cpolar daemon status
sudo systemctl status cpolar
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/e88c896be2f80d029b92f120cba944d9.png)
- reboot
sudo reboot
![Building a Web site on a Raspberry Pi [no public IP needed]. Building a Web site on a Raspberry Pi [no public IP needed].](https://imgs.developpile.com/imgs/f94d50ae4900cdf9ef08015539e31f7a.png)