Difference between revisions of "Simulate a web server"

From TSG Doc
Jump to: navigation, search
(Add instructions on how to simulate a webserver locally)
(No difference)

Revision as of 14:48, 24 April 2020


These steps are useful if you are developing an online experiment with data transfer involved and would like to simulate it locally on your computer. Especially when large amounts of data are involved and you cannot use the RadCloud data storage solution as described here. Data transfer from client to server is handled via http-requests. In this request a script file is defined that runs server side. To mimic this on your local computer, you need to start your own local web server. Below, instructions on how to do this on both Windows and Mac Operating systems.

For windows:

You can find and download the php-webserver on this webpage.
On top find the selection box “Binaries and sources Releases”, choose: VC15 x64 Thread Safe and download the zipfile. Unzip it and you will end up with a folder that contains everything you need, no further installations are required. Remember where you put this folder on your drive, you’ll need it to start the server.

Click Start and type cmd to launch a command (DOS) window.

For macs:

A php-server is default installed, open a terminal window, via Spotlight (cmd-space) search for terminal.

Change the working directory to the downloaded and unzipped PHP folder (type cd <folder> and replace <folder> accordingly). Start the php-server by typing: php -S -t <folder containing your web application> and change <folder containing your web application> accordingly. Start a web browser of your choice and browse to the url: localhost:8000/<index.html> Replace <index.html> with your web application’s starting html-file. The browser should now display your web page or web application, serviced by your local php-server.