Written by Michael Kelly
More and more people are wanting to create their own websites, but, unfortunately, just aren’t quite sure where to start. Places like WordPress or Tumblr will let you create something quickly, but it’s often not what people are looking for. Luckily, for anyone with a NetID, Duke provides basic but usable web hosting that you can use to start your very own website (or store small files to share with people).
The first step is simply figuring out where your space is–all you need to know is your NetID. Your URL will be http://duke.edu/~yourNetID. I’m http://duke.edu/~mck16. It’s really that simple. Go ahead and check yours out. It should be delightfully empty. The next step is getting some content up there… but, how do we do that?
We’re going to use a very popular, easy-to-use standard called FTP (it stands for file transfer protocol, but that’s not important). What is important is that FTP let’s us take files from our own computers and upload them to a remote server (which, for us, is a Duke server). We’re going to be using the FTP client Cyberduck (http://cyberduck.ch/), a FTP client installed on all MPS Lab machines. Go ahead and open Cyberduck now (or download & install it first if you’re not on a lab machine). The default window should look something like below:
If it looks complicated, don’t worry, it’s actually pretty use to use. Our next step is to connect to the server–for this, we need five pieces of information:
1. The server URL. In our case, Duke’s server is login.oit.duke.edu.
2. The username we’re connecting as, which, for us, is your NetID.
3. The password for the username, which is your NetID password.
4. The port number we are connecting to on the server–we’re going to actually use SFTP, a variant of FTP that is a little more secure (think of the ‘S’ as standing for Secure). The default port number for SFTP, and the one we’ll be using, is 22.
5. The path we are requesting on the server. This part is a little tricky and very specific to the way Duke’s IT department sets up their servers. Our path will be formulated as /afs/acpub.duke.edu/users/firstLetter/secondLetter/fullNetID, where firstLetter is the first letter of your NetID, secondLetter is the second letter of your NetID, and, naturally, fullNetID is your full NetID. For example, if your NetID was abc12, the path would be /afs/acpub.duke.edu/users/a/b/abc12. Go ahead and figure your path out now, we’ll need it in the next step. My NetID is mck16, so I’m /afs/acpub.duke.edu/users/m/c/mck16.
Now, go ahead and click the “Open Connection” button in the top left corner of the main window, bringing up a dialog box that looks like below. You’ll also want to go ahead and click the circled arrow to bring down the “More Options” pane. The full screenshot is below:
We’ll need to change a few options for our connection. First, click the “FTP (File Transfer Protocol)” dropdown and select the “SFTP (SSH File Transfer Protocol Option)”–this tells Cyberduck that we want to use a secure connection. Then, put login.oit.duke.edu as your server, your NetID as your username, and your NetID password as your password. And be sure to uncheck “Anonymous Login”. Also, under the “More Options” pane, we’ll need to put in the path we formulated from above (mine was /afs/acpub.duke.edu/users/m/c/mck16). In the end, the dialog box should look something like this:
Once you’ve filled the five fields in, go ahead and click the “Connect” button. If you entered everything correctly, you should see something like this:
If not, you most likely entered your username or password wrong–re-type them and try again. What is important here is the listing of files below the toolbar. This shows you all the files you have on the server. If you’re like me, you’ve got all sorts of random stuff there, but you also might not have anything. For this tutorial, we’re going to be putting up a very, very simple webpage. And to do that, we need our files to be visible to the Internet. There’s a special folder for files like this, called “public_html”. Anything in the public_html folder can be viewed. For example, if we had a file named test.txt in /public_html, it would be accessed as http://www.duke.edu/~netID/test.txt.
We’ll be doing something very similar to that, only instead of a simple plain text file, we’ll use HTML. This tutorial doesn’t cover HTML in depth and is intended simply as a starting point to using the Duke-provided webspace. There are a ton of excellent HTML resources on the Internet though (and Duke offers Lynda.com web development tutorials free for NetID users!). So, double click on the “public_html” folder–there will most likely not be any files in your public_html folder, but that’s ok for now!
Now, open up any text editor and type the following in:
<title>My First Webpage</title>
<p>Welcome to my website!</p>
Then save the file as “index.html”. If you’re wondering why we chose to use “index.html”, it’s because “index” has a special meaning when it comes to websites and servers. Whenever you load a webpage, say Google or even Duke’s, the server looks for the “index” page and it is the first one to be displayed. So, if you went to http://duke.edu/~mck16, it would look for a file called index.html. Try it out–see http://duke.edu/~mck16 and http://duke.edu/~mck16/index.html. Should be the same thing!
Go ahead and switch back into Cyberduck. We have one last step–we need to upload our file to the server. To do this, go to “File -> Upload” (from the menubar on the top of the screen). This will bring up a standard file dialog box. Navigate to your saved “index.html” file and click “Upload”.
Cyberduck will handle the rest–your “index.html” file will be uploaded to the server and stored in your “public_html” folder. Now you have a very simple but very functional website of your own! Be sure to try it out! The next step is learning a little more about HTML and all the cool things you can do with that. The Spark has some great tutorials on HTML (see http://sites.duke.edu/oit-mps/?s=html) and I highly recommend http://lynda.com and http://www.w3schools.com/html/ as well. Good luck!