Building Your Own Website Server with Raspberry Pi and Orange Pi

Building Your Own Website Server with Raspberry Pi and Orange Pi

Breadboard Community Disassembly EventDrone, Handheld OscilloscopeComputerRobot VacuumSmart WatchSolid State DrivePortable Speaker,Great Prizes and Benefits, Welcome to Join!More Details👈Building Your Own Website Server with Raspberry Pi and Orange Pi

Effect Display

(1) Orange Pi Zero 3

Building Your Own Website Server with Raspberry Pi and Orange Pi

(2) Website Screenshot

Building Your Own Website Server with Raspberry Pi and Orange Pi

(3) Server Latency Speed

Building Your Own Website Server with Raspberry Pi and Orange Pi

Preface

(1) I wonder if everyone has one or more servers at hand, servers are very helpful for project work, especially when adding many fun elements to microcontrollers; or creating a blog to share products made; or even developing websites and web applications. Although lightweight servers from Alibaba Cloud, Tencent Cloud, Microsoft Cloud, etc., are quite cheap, costing around a hundred yuan for a year, having your own server is much more convenient, and most boards on the market, including Linux boards, can set up web servers for about a hundred yuan. So today, I will use the Orange Pi as an example to share how to set up a web server from scratch, and connect to the external network. [I would be very grateful if a big company is willing to sponsor me a Linux development board 🙂 ]

(2) Project Requirements:

① Linux Development Board Linux Host (must have network capabilities, and the configuration should not be too low, above 2 cores and 1G)

② SD Card (must buy a U3 level high-speed card, with a transfer speed of 100/MS)

③ SD Card Reader (needed to burn firmware to the SD card)

④ USB to Serial Tool (to connect the computer to the Linux development board)

==============================================

Advanced Requirements (Public Network):

① Public IP (to connect to the external network, application tutorials can be found online)

② CDN (because the public IP cannot use port 80, CDN is needed to map the public IP to the domain name, allowing access to the website through the domain name)

③ Registered Domain Name (servers in China must be registered)

Burning Ubuntu Image

(1) First, let’s install a system on the development board; if you already have a system, you can skip this step and jump directly to [Setting Up Linux Panel]

Go to the official website of your development board to download the corresponding image file; I am choosing the Ubuntu image for Orange Pi here

Orange Pi Official Website: http://www.orangepi.cn/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-Zero-3.html

[Since the system file is 4G and hosted on Baidu Cloud, the download may take several hours; if you really don’t want to wait, you can email me at [email protected], and I will send it upon seeing the email]

Building Your Own Website Server with Raspberry Pi and Orange Pi

(2) Use balenaEtcher_v1.7.2 to burn the firmware to the SD card

Building Your Own Website Server with Raspberry Pi and Orange Pi

Software Official Website: https://etcher.balena.io/#download-etcher (the website is slow, the download link may take a while to show)

You can download it from my shared link: https://wwmg.lanzouj.com/ifd2c29gbyeh

Building Your Own Website Server with Raspberry Pi and Orange Pi

Select the Ubuntu image file first, then select your SD card, and finally click Flash to start the download

Building Your Own Website Server with Raspberry Pi and Orange Pi

(3) Insert the SD card into the development board, then power on and wait a moment

Find the serial port of the Linux development board (RX|TX), connect it with the USB serial tool; since the development board currently has no SSH connection and no network, debugging can only be done via the serial method

Building Your Own Website Server with Raspberry Pi and Orange Pi

Building Your Own Website Server with Raspberry Pi and Orange Pi

RX —- TX

TX —- RX

GND —-GND

(4) Open MobaXterm software, you can communicate with the development board through this software

Download Link: https://mobaxterm.mobatek.net/download-home-edition.html

LanZou Cloud: https://wwmg.lanzouj.com/ifd2c29gbyeh

Building Your Own Website Server with Raspberry Pi and Orange Pi

Select Session, Serial, choose the correct port, baud rate 115200

Building Your Own Website Server with Raspberry Pi and Orange Pi

If everything is fine, press Enter, and you should see the Orange Pi logo; if there are issues, email me

Building Your Own Website Server with Raspberry Pi and Orange Pi

(5) Connect to the Internet, connect to WiFi or Ethernet; here I will teach you how to connect to WiFi

sudo nmcli dev wifi connect wifi_account password wifi_password
Just enter the above command, input the wifi and password, if prompted to enter the root password, the default root password is orangepi

Building Your Own Website Server with Raspberry Pi and Orange Pi

If it shows successfully, it means the WiFi connection is successful

Setting Up Linux Panel

mdserver-web Panel

Open Source Address: https://github.com/midoks/mdserver-web?tab=readme-ov-file

Building Your Own Website Server with Raspberry Pi and Orange Pi

This panel is what I believe is the most suitable for website management (based on my experience with several popular panels); this panel has no ads, is open source, and includes many plugins for free! There won’t be any flashy features that overload the server or occupy idle resources

Just use the script to install it

Building Your Own Website Server with Raspberry Pi and Orange Pi

curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash

(2) Wait for about 20-30 minutes; the better the board’s performance, the faster the installation; if you haven’t been watching the installation, wait half an hour, then input “MW”

Building Your Own Website Server with Raspberry Pi and Orange Pi

Then follow the prompts, first enter 11 to change the password, then enter 12 to change the username, and finally enter 10 to display the panel’s URL

Building Your Own Website Server with Raspberry Pi and Orange Pi

(3) Click the URL to enter, then enter the username and password, and download the required components for the URL

Building Your Own Website Server with Raspberry Pi and Orange Pi

1. Download OpenResty, a high-performance Web platform based on Nginx and Lua

2. Download PHP, select the required version

3. Download MySQL, select the required version of the database

[The above are the three components necessary for the website to run]

[Suggestion: It is essential to download two defensive measures to avoid server intrusion, as being hacked can be very troublesome!]

4. Download OP Firewall, which can enable all defenses

Building Your Own Website Server with Raspberry Pi and Orange Pi

Building Your Own Website Server with Raspberry Pi and Orange Pi

5. Download System Hardening, enabling all hardening features

Building Your Own Website Server with Raspberry Pi and Orange Pi

Building Your Own Website Server with Raspberry Pi and Orange Pi

Router Settings

(1) The router needs to be set up to allow access to the server’s content; I am using a Xiaomi router, and you can set it up according to your own router, the method is similar.

Xiaomi Router Address: 192.168.31.1

Building Your Own Website Server with Raspberry Pi and Orange Pi

(2) Select Advanced Features —- Port Forwarding

Building Your Own Website Server with Raspberry Pi and Orange Pi

(3) Enable DMZ feature, choose any IP; I choose 192.168.31.101

Building Your Own Website Server with Raspberry Pi and Orange Pi

(4) DDNS Feature

DDNS can turn an IP into a domain name, so you don’t need to use CDN; others can also access your website through the domain name

It can save the need for CDN and domain name

However, the downside is that the free service of DDNS has very little traffic, and the response speed is slow, which may affect the experience

Building Your Own Website Server with Raspberry Pi and Orange Pi

Building the Website

(1) Return to the panel, after all components are installed, click to add a website

Input the router’s DMZ set IP, then add the desired port; since port 80 is not open, you must add a port

Building Your Own Website Server with Raspberry Pi and Orange Pi

(2) Enter your IP in the browser; mine is 192.168.31.101:888

If it shows Work has started!!!, it means success

However, at this point, it can only be accessed internally; for external access, a public IP is required

A public IP needs to be opened by the operator; there are tutorials online

Building Your Own Website Server with Raspberry Pi and Orange Pi

(3) Internal Network Penetration

If you already have a public IP, you can use Alibaba Cloud CDN or the router’s DDNS

Alibaba Cloud CDN Advantages: Fast speed, security, stability, custom domain name

Alibaba Cloud CDN Disadvantages: Paid, approximately 126 yuan for 1T traffic, requires API to automatically resolve dynamic IP, requires registered domain name

Building Your Own Website Server with Raspberry Pi and Orange Pi

Router DDNS Advantages: Free, built-in domain name without registration

Router DDNS Disadvantages: Slow speed, unstable, domain name cannot be customized

Building Your Own Website Server with Raspberry Pi and Orange Pi

=============================================

Since each router’s DDNS is different, the DDNS method can only be found by everyone themselves; here I will share how to configure after buying CDN

Configuring CDN and Domain Name

(1) Choose a domain name (the domain name must be registered)

Building Your Own Website Server with Raspberry Pi and Orange Pi

(2) Origin Station, the origin station is the public IP plus the port

Building Your Own Website Server with Raspberry Pi and Orange Pi

(3) To ensure efficiency, I set the cache settings to not cache, so that information can be updated in a timely manner; since mine is an API website, everyone can adjust according to their needs

Building Your Own Website Server with Raspberry Pi and Orange Pi

Verification

After the CDN configuration is complete, input the domain name to open the website

http://api.xemowo.top/

Building Your Own Website Server with Raspberry Pi and Orange Pi

If it doesn’t open, possible issues include:

1. In the website management panel, security, remember to allow the port

2. The domain name is not configured to the CDN

3. Router DMZ configuration failed

4. Website component download failed

5. Linux board configuration is too low

Summary

(1) The Linux development board is quite friendly for setting up small websites and blogs; it can run perfectly without lag, but it may struggle with large applications; for large applications, it is recommended to use proper servers or cloud servers

(2) Since the server uses a home network, it is advisable to limit the Linux bandwidth and ensure proper website protection; if hacked, the home network may become overloaded, so security is paramount

(3) If you are not a corporate user or VIP user, I recommend the mdserver-web panel; do not use Baota panel or other paid panels, as the Linux development board itself has a low configuration and does not need so many fancy features, so a high-end panel is unnecessary

Building Your Own Website Server with Raspberry Pi and Orange Pi

Leave a Comment

×