An overview of the

This is perfect for setting up your first website and learning how to manage not only wordpress sites, but Linux as well. You’ll need a Raspberry Pi, a few hours, and a computer to download the image. The raspberry PI (RPI) is the perfect device to learn these things.

Install Raspberry Pi OS using Raspberry Pi Imager

Download the Raspberry PI Mirroring tool for your operating system. It supports most operating systems (Windows, Mac, and Linux).

www.raspberrypi.org/downloads/

  • 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

Example Set the Apache Web server

Apache is a popular Web server application that you can install on Raspberry Pi to allow it to serve Web pages.

Apache itself can serve HTML files over HTTP. With additional modules, it can provide dynamic web pages using scripting languages such as PHP.

sudo apt-get install apache2 -y
sudo service apache2 restart
Copy the code

Testing the Web site

By default, Apache places the test HTML file in a Web folder that you can view from your Pi or another computer on your network.

Open the Apache default page on Raspberry Pi:

  • Open Chromium by choosing Internet > Chromium Web Browser from the menu.

  • Enter the address http://localhost\

You should see in your browser window:

Install the static sample site

To make the content of the site more meaningful, we deployed a simple static demonstration site, the Meditation And 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
Copy the code

Open it again in your browser and refresh the site: http://localhost

This is a meditation gadget site that can help you relax for 2-10 minutes after work.

It can choose different meditation scenarios and relaxation time (2-5-10 minutes).

Publish web sites to the public network

Currently, this site can be accessed only on local web sites, but not on public networks. In order for everyone to access your beautiful site, here’s what we need to do.

Install Cpolar

Cpolar is an Intranet penetration tool that exposes your Intranet sites to the public network so that everyone can access your site.

  • Cpolar one-click installation script :(for domestic users)
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
Copy the code
  • Or short link installation mode :(foreign users)
curl -sL https://git.io/cpolar | sudo bash
Copy the code
  • View the CPolar version
cpolar version
Copy the code

If the display is normal, the installation is successful, as shown in the figure:

Cpolar performs token authentication

If you do not have a CPolar account, please go to the CPolar official website to register and log in to obtain the authentication token

cpolar authtoken xxxxxxxxxxxxxxxxxx
Copy the code

Generate cPolar random domain address

cpolar http -region=cn_vip 80
Copy the code

The figure above shows that Cpolar has posted Intranet sites to a random domain address: 711d7522.vip.cpolar

  • Let’s open a browser and try: 711d7522.vip.cpolar

Now, we have published the Intranet Web site to the public network so that anyone can access it.

Go back to the Terminal window and press CTRL+C to exit CPolar

In this case, the public address cannot be accessed.

Generate the cPolar secondary subdomain name

Although the domain name is released to the public network, the domain name changes randomly and is only suitable for temporary test. If we want to use it for a long time, we need to configure the secondary subdomain name.

Operation steps:

  • Upgrade to the CPolar base package
  • Log in to the CPolar background –> Reserve –> Reserve the secondary subdomain, for example, adddev9, regional selectionVIP Chinaregion

Test the domain name on the front terminal

cpolar http -subdomain=dev9 -region=cn_vip 80
Copy the code

If the display is normal, we have configured it.

Use the new domain name in your browser: dev9.vip.cpolar

Normal means that our fixed secondary subdomain is configured.

Save the parameters to the CPolar profile

We just ran the cPolar program in the foreground. When we closed it, the domain name disappeared. Now we save the parameters to the configuration file. To support the startup of the background operation.

  • Editing a Configuration File
nano /usr/local/etc/cpolar/cpolar.yml
Copy the code

As shown in figure:

The sample configuration file above configures two default tunnels: an SSH tunnel and a Website tunnel.

Parameter Description:

Authtoken: XXXXXXXXXXXX # Authentication token tunnels: SSH: # The name can be customized. Addr: 22 # The port number is 22. Addr: 8080 # local Web site proto: HTTP region: CN_VIP, optional: us, HK, CN, cn_VIPCopy the code

In this example, we need to modify the following:

  • Will website tunnel by default8080Change the port to80
  • Add a lineSubdomain: Your subdomain

The effect after modification is shown as follows:

Note: Configuration files are yamL format, indent sensitive, and cannot have TAB keys.

Then press CTRL+X to exit, ask if you want to save, answer Y, confirm the path to save the file, and press Enter

Test the modified configuration file

Start all tunnel tests in the foreground

cpolar start-all
Copy the code

If it is normal, press CTRL+C to exit

If an error message is displayed, a message is displayed indicating an error in a certain line of the configuration file. Modify the configuration file again. Until the output is correct like the one above.

Configure the CPolar service to start automatically upon startup

  • Configure cPolar to start automatically upon startup
sudo systemctl enable cpolar
Copy the code
  • Start CPolar in daemon mode
sudo systemctl start cpolar
Copy the code
  • Check the status of the Cpolar daemon process
sudo systemctl status cpolar
Copy the code

As shown in the figure, the startup status is successful

  • Restart the
sudo reboot
Copy the code

After the restart, check whether the CPolar tunnel is still online

— > state dashboard.cpolar.com/status access to the background

The following figure shows that the configuration is successful