Operations 12 min read

How to Set Up Raspberry Pi Zero W: Install OS, Enable SSH, and Publish a Web Server

This guide walks you through the entire process of preparing a Raspberry Pi Zero W, flashing a Raspbian Lite image, configuring Wi‑Fi and SSH, installing Nginx, optimizing the system, and exposing the web server to the internet using tunneling services.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
How to Set Up Raspberry Pi Zero W: Install OS, Enable SSH, and Publish a Web Server

What is Raspberry Pi?

Raspberry Pi (RPi) is a credit‑card‑sized micro‑computer designed for learning programming. It runs Linux and, with Windows 10 IoT, can also run Windows.

Since its release it has been popular among hobbyists and makers. Despite its small size it offers video, audio and many I/O interfaces.

My understanding

It is essentially a tiny host that can connect to a monitor, keyboard, mouse, USB drives, etc., and provides many serial and GPIO ports for low‑level hardware access.

Available models

Most common are the 3‑generation B+ boards, priced around 230 CNY for the bare board. A cheaper alternative around 100 CNY is the Raspberry Pi Zero W.

Raspberry Pi Zero W

The Zero W is a mini version, about one‑third the size of a 3B+. It is extremely small and cute.

Raspberry Pi Zero W size comparison
Raspberry Pi Zero W size comparison

The picture shows a pen, a plug‑and‑play Wi‑Fi dongle, a USB card reader and the Zero W at the bottom.

Zero W specifications

BCM2835 processor, 1 GHz, 512 MB RAM

BCM43438 Wi‑Fi / BT chip

Micro‑USB power port

Micro‑USB OTG port

mini HDMI port

Composite video and reset pins

CSI camera connector

Micro‑SD slot for OS

40‑pin GPIO header

Dimensions: 65 mm × 30 mm

Although it has a single‑core CPU and only 512 MB RAM, it can still run a small web server.

Installing the OS on Zero W

1. Preparation

16 GB or 32 GB SanDisk micro‑SD card

Standard USB‑type‑A cable (not USB‑C)

SD card formatter (e.g., SDFormatter)

Image writing tool (Win32DiskImager)

Raspberry Pi OS image (download from the official site)

I used the Raspbian Stretch Lite image, which is a minimal console‑only version.

Raspbian Stretch Lite
Raspbian Stretch Lite

2. Download the image

After downloading, unzip the .zip file (≈360 MB) to obtain an .img file (~1.7 GB).

Image download
Image download

3. Write the image to the SD card

Win32DiskImager
Win32DiskImager

Insert the card into a reader, select the .img file in Win32DiskImager, choose the correct device and click “Write”.

4. Enable SSH and Wi‑Fi

After the write, the boot partition (≈40 MB) is visible on Windows. Create an empty file named ssh (no extension) to enable SSH on first boot.

Create a wpa_supplicant.conf file with the following content (replace with your Wi‑Fi SSID and password):

country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="your_wifi_name"
    psk="your_wifi_password"
}

5. Assemble and power up

Insert the SD card into the Zero W, connect a USB power cable (5 V 1 A) and wait a few minutes. The LED will blink then stay solid.

Zero W IP address
Zero W IP address

Find the IP address (e.g., 192.168.0.104) on your router and SSH into the device (default user pi, password raspberry).

SSH login
SSH login

6. System optimization

Replace the default apt sources with a domestic mirror (e.g., USTC).

Run sudo apt-get update && sudo apt-get upgrade.

Configure timezone with sudo dpkg-reconfigure tzdata (select Asia/Shanghai).

Enable SSH on boot via sudo raspi-config or by adding /etc/init.d/ssh start before exit 0 in /etc/rc.local.

7. Install Nginx

# Install
sudo apt-get install nginx
# Start
sudo /etc/init.d/nginx start
# Restart
sudo /etc/init.d/nginx restart
# Stop
sudo /etc/init.d/nginx stop

Browse to http://192.168.0.104 to see the default Nginx page.

Nginx page
Nginx page

8. Expose the service to the Internet

Use a tunneling service such as ngrok, ittun or natapp to forward the local web server to a public URL.

ngrok public URL
ngrok public URL

Running ngrok in a screen session keeps it alive, but automatic startup is still a manual step.

Further reading

The Raspberry Pi can do much more than host a website; explore the Raspberry Pi Lab for additional tutorials and projects.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxNginxIoTRaspberry PiSSHSystem SetupZero W
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.