Setting Up A Local Server

On this page

A web server is a special piece of software that listens to requests for files and then serves them very quickly to the computer which requested them. To emulate how our site will work on a production server, we need to have a similar set up on our local machine.

Starting a Server

1
Open CommandBox and navigating to your class repo

In Commandbox, in the top folder of your class repo, type server start. Wait a minute while the web server and the BoxLang server are configured. A browser will open and you’ll see the main page of a website.

2
Look at the URL Bar and notice the IP Address and Port

Pay close attention to the address in the address bar. It will look something like http://127.0.0.1. This means that the page is being served off of a web server on your machine over the IP address 127.0.0.1. This is a special IP address which always refers to the local machine no matter what. After the IP address is more information with a :##### (a number). This is very important to include. If you just type in http://127.0.0.1, you will not get this site. You might want to bookmark this address or simply remember that you can go back to CommandBox to type server open to open the browser again.

3
Try Stopping the server

You can stop the server by typing server stop and enter in CommandBox from the same folder in which you started the server. This last part is important. If you type server start in a different folder, a new server will start on a different port and you will have two running at the same time. This is very handy if done deliberately but can be confusing if it isn't.

4
Start it up again, we're going to need it

In CommandBox make sure you are in the same folder and type server start

Lesson 3 of 5 - CommandBox