Raspberry pi is a low cost development board by the raspberry foundation,for this tutorial i am using the distro provided by adafruit that can be found at http://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/occidentalis-v0-dot-2 all you need to do is download the image and use WIN32 disk to burn the image on to the SD card. This tutorial is very different from rest and focuses on hosting a site from raspberry pi and make it accessible ONLINE (from anywhere in the world).

Step 1: Connect via SSH

Now connect your raspberry pi to home router using a Ethernet cable. the ada-fruit image comes with SSH enabled so you can connect via SSH immediately.

now you should try to open a SSH session via putty to raspberrypi.local or the speccific IP address( if you have ur HDMI connected it should be there on you screen, or go to ur router config page(usually and check for raspberry pi under DHCP). you can log in to the raspberry pi with user name :pi and password :raspberry.
<p>Thanks for the tutorial! Before I try this out, do you NEED to be able to port forward to host a website with Pi? I have an application where the only internet connection is using a cellular hotspot, and try as I might, I cannot port forward. </p>
Most hotspot modems also have NAT or port forwarding. the problem is the Pi get a local IP address and the modem / hotspot get another public ip address. now the modem need to know when traffic comes on port 80 forward this to the Pi (local ip address). The modem will discard the packets if it does not now where to send the requests to (when you browser sends a request to the public ip address).<br><br>https://www.youtube.com/watch?v=O7CuFlM4V54
<p>Thanks for the quick response and informative video. My issue is that when I use this device:</p><p><a href="https://www.att.com/devices/netgear/unite.html#sku=undefined" rel="nofollow">https://www.att.com/devices/netgear/unite.html#sku...</a></p><p>I can setup port forwarding on the device, but there appears to be another router on the ISP side that I cannot control. Any suggestions?</p>
Best Tips to Build a Great and User Friendly Website<p><a href="http://www.besthacktricks.com/best-tips-to-build-a-great-and-user-friendly-website/" rel="nofollow">http://www.besthacktricks.com/best-tips-to-build-a...</a></p><p>Grab all the tricks and tips on latest android phones,apps,iphones and latest technews at www.besthacktricks.com...visit now!</p>
<p>Great tricks and tips</p><p><a href="http://www.besthacktricks.com/top-factors-to-consider-before-purchasing-a-domain/" rel="nofollow">http://www.besthacktricks.com/top-factors-to-consi...</a></p><p>Get latest offers,tricks and tips on android,iphone and windows,technews etc.</p>
<p>Thank's for tutorial :)</p>
<p>So does this mean I can use my raspberry pi to have my web page online using my domain? I have a domain <a href="http://www.theridgeprogram.com," rel="nofollow">www.theridgeprogram.com/</a> so could I have my raspberry pi as the server instead of the paid web hosting, so everyone can see it?</p>
<p>Yes, technically you should be able to do exactly that. Beware though that depending on the traffic your site receives, your pi and network connection may be overwhelmed. I found this fairy easy to do. Followed the steps given at </p><p><a href="http://projpi.com/diy-home-projects-with-a-raspberry-pi/pi-web-server/" rel="nofollow">http://projpi.com/diy-home-projects-with-a-raspber...</a></p>
<p>Thanks! </p>
<p>some packages, such as lighttpd and giving your Raspberry Pi a static IP address.</p>
<p>I'm having problems transferring html files. I got all the way through restarting apache (after changing AllowOverride None to AllowOverride ALL). When I tried the &quot;sudo chmod 777 /www&quot; command (after changing the directory to /var/), however, it gave me the response &quot;chmod: cannot access '/www': No such file or directory.&quot; I installed WinSCP and found the www folder and I confirmed that the default site displays properly. When I try to transfer files it says &quot;Permission denied.&quot;</p><p>Does anyone know what's wrong and/or how to fix it?</p>
<p>Okay, obviously I'm new at this. I solved my problem by dropping the forward slash in front of &quot;www&quot;.</p>
<p>you can also check if your website is up and running by going opening midori browser on raspberry pi and typing in &quot;localhost&quot;</p>
<p>when you are trying to access your website from the internet, check you internet IP address using google &quot;what is my ip&quot;(after you have setup port forwarding). you lan ip four computer is different from your WAN ip address of your router. To access your website make sure you enter the wan IP.</p>
<p>if you have the no-ip service on you router you can skip step</p><p><strong>sudo wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz</strong><br><br><strong>tar xf noip-duc-linux.tar.gz</strong><br><br><strong>sudo rm noip-duc-linux.tar.gz<br><br>cd noip-2.1.9-1/</strong><br><br><strong>sudo make install</strong></p>
<p>Hi, yes you should he storing the index.html in /var/www/ . Some routers have no-ip service that you can enable from your router admin page. also make sure you have edited apache config file to allow all IP, but default the server might only allow you local lan to access the website</p>
<p>Hi! Thanks for the tutorial, but I am still running into a few hurdles. I followed every step. Just to make sure, I am supposed to upload my index.html file to /var/www right? I do have a PID running, but if I try to go to my website, it only shows &quot;400 bad request&quot;. Do you think you could help me?</p>
<p>Yeah I have exactly the same issue!</p>
<p>Hey, did you ever fix your problem? I am giving another go at this, and although I can access everything locally with no problem, I can't see to put it online.</p>
<p>I ended up doing a different thing. Where I set up no ip on my router and then set up port forwarding (also on my router) in conjuction with my RP. Let me know if you need help. I also tried using pagekite but that can get quite expensive depending on traffic. Even though I would definitely recommend it if I was creating a test server or something... But I am using my server as a backup site which obviously uses a lot of traffic... Hope that helps...</p>
<p>I know how to do port forwarding and stuff (I think!), but I don't understand when you say you set up noip on your router. Can you explain that part?</p>
<p>Hey! Nice and easy to follow tutorial! <br>But even tho I double checked every step, I still cant reach my content. </p><p>Calling the Pi's Local IP through an other device's browser displays the <br>index.html in the /var/www folder properly, but using either the global <br>ip or the no-ip.org domain results in a network timeout error.</p><p>- noip2 process is running (pid, current global ip and noip-domain is shown)</p><p>- 000-defaults file is edited (&quot;None&quot; to &quot;ALL&quot; - also checked &quot;All&quot;)</p><p>- No-IP Website show pi's currend global IP and No-IP Domain aligned</p><p>- Port-Forward for Ports 80 and 21 for the Pi's local IP are enabled</p><p>Any further advice?! <br>Thanks in advance <br>Best regards and keep up the intuitive tutorials</p>
<p>Running Raspian tho... </p>
<p>I am having the same problem I have gone through another tutorial too: http://forum.xda-developers.com/showthread.php?t=2019600 which uses PageKite rather than No-ip but pagekite is really expensive! Please let me know if you find a solution!</p>
<p>Do you think it may be to do with port forwarding? </p>
<p>Jup I contacted my IPS.. It's because im using global IPv6 adresses with Dual-Stack Lite. Therefore my devices do not get a global IPv4 adress to enable Port Forwarding... They offered me to activate the IPv4 (real Dual-Stack) for an additioal monthly fee... <br><br>Isn't there any way to achieve the same goal with IPv6 enabled on the Raspberry?! (Except Portmapping expensive services)</p>
<p>Hey! I was wondering if you solved your problem? I think I am in the same situation. I can access my website on my local network but not on the internet...</p>
<p>Excellent tutorial! Now i would like to get some security to prevent some hacking activity. Where i can find some info about this? I thinks is installing SSL or something like that. Do u know any info about this? Thanks!</p>
This is a very clear, complete, and easy to understand tutorial. Excellent work!
<p>Hey can u plz send me that tutorial? Am not able to get it.</p><p>e-mail : rahulr25@gmail.com</p>
<p>thank you...</p>
<p>Hi all, now I start Raspberry Pi collocation in heart of Europe, more info find here: <a href="http://raspberry-hosting.com/" rel="nofollow">http://raspberry-hosting.com/</a> Enjoy !</p>
<p>Would there be anyway for me to use a domain name that I have already bought on GoDaddy?</p>
<p>Yes you should be able to do it, by editing your CNAME from your control panel and setting it to your HOME IP / no-ip domain name</p>
<p>you&rsquo;re referring to GoDaddy's admin area (or any other provider), correct? </p>
<p>completed without a hitch. fantastic! thanks! </p>
<p>I've done every step but when I type in my domain on Firefox it cannot connect... What's the problem?</p>
<p>hi, is it working when you type in the IP address in the browser? is the Pi on the same subnet as your PC? did you edit the <strong>/etc/apache2/sites-enabled/000-default </strong>to allow all IPs</p>
<p>My /etc/apache2/sites-enabled/000-default allows all IPs (I changed &quot;<strong>AllowOverride None</strong>&quot; -to &quot;<strong>AllowOverride ALL</strong>&quot;.) but it doesn't work.I don't wich subnet on my Pi is good so here's a pic</p>
<p>I dont know wich subnet*</p>
hey, I am trying to run adafruit on my raspbbery but this is not respond. <br>Actually I download adafruit and used win32disk to write in in my SD card. <br>Then I put SD card in raspberry pi but its not respond. Why? <br>Thank you very much please help me
I had the same problem. It is the ram on the Pi. The adafruit image requires a Pi that does not have HYNIX ram. You can try to simply run any debian image for the Pi, since it has the enable SSH option during first startup and setup. Worked for me.
<p>try another card, or check if the Lock swirch is enabled on the card</p>
<p>Clear &amp; concise instructions. I've previously tried to get my Raspberry Pi set up as a web server by following instructions I've found in a book I purchased and a different web site, but none ever worked. This one works great, thanks!</p>
<p>thank you...</p>
This is such a great tutorial !! Thank you a lot. Furthermore, I have added another port redirection to my server (weird number like 9562 to 22) so that I can also log in SSH to my raspi. So great !
<p>thats a good idea!!</p>
nice, are there restrictions on the types of pages you can host? basic html? or is css/javascript/etc ok too?

About This Instructable


252 favorites


Bio: DIY, electronics...and loves getting creative...
More by sajingeo: Real World Minecraft Bluetooth Speakers using Raspberry Pi Raspberry pi loves Sensors and LEDs
Tags: raspberry pi
Add instructable to: