Raspberry Pi 3 Tutorial 15 – Setup a Website on your Pi!
Difficulty level: Beginner
Approx reading time:
1. Raspberry Pi 3 model B
2. MicroSD card 8 or 16 GB (Class 4 and above) with Raspbian Jessie
3. Windows PC / Linux PC (Tested on Windows 10, Ubuntu 14.04 LTS)
4. Ethernet cable (Category 5 – also called Cat 5)
5. Micro USB cable
Way to go ->
1. Login to your Pi using PuTTy or your Ubuntu terminal.
2. Login to your Pi GUI using VNC server (Linux / Windows).
3. In the terminal type:
sudo apt-get update
4. In the terminal type:
sudo apt-get install apache2 -y
5. Connect your Pi to your WiFi.
6. Note down your local IP(eg:- 192.168.1.19). In the terminal type:
7. Enter IP in your browser. You’ll be greeted by this page.
8. In the terminal type:
9. See html directory if raspbian jessie. In the terminal type:
10. In the terminal type:
11. See index.html directory
12. Delete the file:
sudo rm index.html
13. Create a new file:
sudo nano index.html
14. Write something in the file such as: Hello World
15. After writing something of your choice, press Cntrl + X on your keyboard then press Y and finally press Enter to save the file..
16. Enter your local IP(from step 6) in your browser and see your webpage.
Setup Port Forwarding:
17. Login to your router (Beetel 450TC3 in my case, yours may be different).
Note: For your particular router you can visit portforward.com and follow the instructions according to your particular router model.
18. Click on Advanced.
19. Go to NAT -> Virtual Server and do the following changes. LAN Ip Address: is your local IP(from step 6).
20. Finally, click Apply Changes.
21. Go to Google and search: what is my ip. Copy Your public IP address.
22. Paste the IP address in your browser followed by the WAN Port: that you configured in your router settings. Eg:- 22.214.171.1246:6000.
23. Done! Now you can access your webpage from anywhere in the world using this address.