Apache Web Server¶
Apache Web Server (Apache HTTP Server) is an open-source, cross-platform web server software developed and maintained by the Apache Software Foundation. It is renowned for its stability, security, and high scalability, supporting a wide range of features through its rich module ecosystem. It is one of the most widely used web servers globally, commonly employed for website hosting, dynamic application support, and reverse proxy scenarios.
This document describes how to install and run the Apache Web Server on a Quectel Pi M1 / L1 Debian system, and access the web pages from a Windows computer on the same local network.
Prerequisites¶
Verify the device environment:
The Quectel Pi M1 / L1 and the Windows host are on the same local network and can communicate with each other
If you plan to install Apache online via
apt, the device must also be able to access Debian software repositories
Check network connectivity:
Run
hostname -Iin the device terminal to view the current IP address, thenpingthe Windows host or gateway address on the same subnet. If you see round-trip time information returned, local network communication is working. You can also runping 10.66.84.17on the M1/Windows host (use the actual device IP) to confirm.
Log in to the development board:
M1: Log in via serial port or graphical interface, using the default
quser.**L1: If the local debug environment is already available, you can also enter the system via ADB; this document uses serial port login as an example. For login methods, refer to debug_uart.md. L1 defaults to
root**login with no system password.
Install Apache Web Service¶
Apache is one of the most commonly used web server programs for providing website access services.
Update the software repository:
sudo apt update
Install Apache service:
sudo apt install apache2 -y
💡 If the current network cannot access Debian software repositories, you can first download the
apache2,apache2-data,apache2-utils, and other architecture-specific installation packages on the host, then copy them to the device for offline installation.
Verify Apache installation success:
/usr/sbin/apache2 -v
Start and Set Auto-Start¶
Start Apache service:
sudo systemctl start apache2
Set to start automatically on boot:
sudo systemctl enable apache2
Check running status:
sudo systemctl status apache2
systemctl is-active apache2
systemctl is-enabled apache2
Allow Web Access Port¶
If the device firewall has restricted port 80, you need to add an allow rule. The following example allows a specified Windows host to access the device’s HTTP service (replace <Windows主机IP> with the actual IP; the M1 test sample is 10.66.84.17):
sudo iptables -I INPUT 1 -i eth0 -p tcp -s <Windows主机IP> --dport 80 -j ACCEPT
View port listening and firewall rules:
netstat -tulnp | grep ':80'
sudo iptables -S INPUT | grep 80
In testing, Apache was found to be listening on 0.0.0.0:80 or :::80. When accessing, use the device’s current IP address obtained via hostname -I.
View Device IP Address¶
hostname -I
Test Apache Installation¶
In a browser on a computer on the same local network, visit:
http://<开发板IP>/
http://10.66.84.182/
If everything is working correctly, you should see the Apache default page.
Change the Default Web Page¶
Apache’s default web page is an HTML file in the filesystem, located at /var/www/html/index.html.
Navigate to this directory and view its contents:
cd /var/www/html
ls -al
This will display the following:
total 20
drwxr-xr-x 2 root root 4096 Oct 30 07:53 .
drwxr-xr-x 3 root root 4096 Oct 30 06:51 ..
-rw-r--r-- 1 root root 10703 Oct 30 06:51 index.html
The system has a default web page file named index.html in the /var/www/html directory, owned by the root user. Since regular users cannot directly modify files owned by root, if you need to edit this web page, you must change its owner to your own username.
M1 (default q user):
sudo chown q:q index.html
L1 or other custom users:
sudo chown <用户名>:<用户名> index.html
Now you can edit this file. After making changes, simply refresh the browser to see the updated web page.
Troubleshooting¶
Symptom |
Possible Cause |
Solution |
|---|---|---|
Windows Command Prompt says |
|
Open Windows PowerShell and re-run |
Able to |
Apache service is not running, port 80 is not listening, or the device firewall has not allowed port 80 |
Run |
|
The device’s current network cannot access Debian software repositories |
First verify the development board has external network access; if only the local network is available, download the |
IP address is correct but still cannot access |
The device and Windows host are not on the same local network, or the IP address changed after switching ADB/Ethernet |
Run |
If Apache is confirmed to be listening on 0.0.0.0:80 but Windows still cannot access it, you can temporarily allow the Windows host to access port 80 (replace <Windows主机IP> with the actual IP):
sudo iptables -I INPUT 1 -i eth0 -p tcp -s <Windows主机IP> --dport 80 -j ACCEPT