Jump to content

Welcome, Guest!

Master Yoda

How to install a Web server

Recommended Posts

How to install a Web server


You will need:
- a Raspberry Pi with all the appropriate cables (power, network cable connected to your network, keyboard, mouse, display)
- an SD card with the debian image (you can follow this guide to create the image)

Setting up a simple web server is very quick and easy following these steps:

1. Power on your Raspberry Pi,
2. When the login prompt appears enter your username and password (currently the default username and password are Username: pi Password: raspberry)
3. Create group www-data:
sudo addgroup www-data


After this command you might have to enter your password again
4. Install the lighttpd server:

sudo apt-get install lighttpd



Now we will create a basic HELLO WORLD web page and put it in the default directory that lighttpd server uses to serve it. To simplify this part we will do this with the Leafpad application in the graphical user interface:

1. Start the graphical mode:

startx


2. Open the Leafpad application by clicking the menu button in the bottom left part of the screen then going to Accessories menu and selecting the Leafpad item.
menu->Accessories->Leafpad
3. Copy the following text to the Leafpad:

 
<!DOCTYPE html> 
<html> 
<head> 
<title>Rasberry Pi</title> 
</head> 
<body> 

<h1>This is my first webpage on the Raspberry Pi</h1> 

</body> 
</html> 




4. Save the file:

Click on the File -> Save As
When the Save As dialog appears:
- into the Name input line enter index.html
- in the Places section of the dialog click on your user name (it has a house icon on its left side - the default at the time of the creation of this manual is pi)
- press the Save button

5. Now we have to move the file to the appropriate location so that the lighttpd server can serve it:
- Open the terminal application by clicking the menu button in the bottom left part of the screen then going to Accessories menu and selecting the LXTerminal item
- Now move the file to the /var/www folder:

sudo mv index.html /var/www/


- When you press enter you have to enter your password.

Now you can see your website in your browser:
1. Click on the Web Browser shortcut in the bottom left of the screen (the earth icon)
2. Into the address line write 127.0.0.1

You should see a web page with the title Raspberry Pi saying This is my first web-page on the Raspberry Pi.
To share your web page with other people you have to give them your outside IP address. To find it out enter the "what is my ip" into the browser search bar and press enter.

If you are accessing the Internet through a router you have to open the port 80 on your router and forward it to your Raspberry Pi network address. To do that consult the manual that came with your router.


To learn more about HTML click here.

Raspberry Pi is a trademark of the Raspberry Pi Foundation .


 

Share this post


Link to post
Share on other sites
Both bring me to the 'What Will You Do With Your Pi' forum.... Maybe it's just something with Tapatalk, I'll look at it at home.

Tutorial Name: How to install a Web server

Tutorial Submitted: 22 June 2012 - 08:30 PM

 

This is the support topic for the above tutorial, which you can view by clicking the link above.

 

Sent from my Nexus 5 using Tapatalk

Share this post


Link to post
Share on other sites

Hmmm, funnily enough that isn't the first time it's happened, although it hasn't cropped up for quite some time. Yes, it's a Tapatalk issue indeed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

About Us

Bringing you the latest Raspberry Pi news, tutorials and user forum.

The Fruity Computer

×