Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Introduction to Programming Basics Writing Your Program

localhost/ - how to access this?

Hi,

Quick question: in this video the instructor has his HTML file appear in Chrome, with the URL "localhost/". I have my code file, but do I need to upload this somewhere for it to appear?

Thanks for your help!

3 Answers

Rasmus Boserup
Rasmus Boserup
973 Points

Hello Adam,

As Shaun has stated above you need to have a local server running. There are many available but MAMP and XAMPP are indeed good solutions.

What you do is download and install them, and then from a control panel you can "start the server". The server is the program that serves the webpages to your browser. This means that when you have it running there will be a folder in which you can put your files, and then by opening your browser you can type in the address:

http://localhost

or

http://127.0.0.1

This will then make the server show you the standard start file (usually called index). If you want to view a specific file you can just attach a / and then the filename to your address in the browser and it will show that. So forexample:

http://localhost/example_page.html

Will show the HTML file called example_page in your server's website folder.

I hope this clears it up a bit :-)

//Raz

Shaun Taylor
Shaun Taylor
2,654 Points

Hi Adam,

I watched a few of these videos earlier today and it seems to access the 'localhost' directory, you need to have the servers turned on inside your local hosting environment.

On a mac it's a programme called MAMP on Windows it's a programme called XAMPP.

These programmes enable you to develop server side websites on your local machine acting as virtual MySQL and Apache servers.

Hope that helps!

Shaun,

Thanks Shaun and Rasmus for your in-depth answers! I've MAMP up and running now, and will request more elaboration on this for future students. Thanks again!