Setting up a portable web server
This guide will setup a portable NGINX web server using Laragon that has support for PHP and MySQL.
This will allow you to develop web applications using PHP and MySQL and move them to different locations for development easily.
You can download it from here.
Make sure that you grab the portable version
Extract the zip file to a location of your choice.
Run laragon
You should see the application window.
Click Start All to start the server.
You will need to enable the web server with Windows firewall.
When running you can access different parts of the server through the buttons on the app.
-
Stop stops the web server
-
Web opens the default webpage
-
Root opens the folder that the webpages are put in
-
Database allows connection to the webserver database (more on this at a later date)
When you click root you will see this initially:
You can also type localhost into the address bar on the computer you are running the server from.
You can put an index.html page into the root folder to see what happens. Try it with the html below
<html>
<title>Example Page</title>
<body>
<h1>Hey this works!</h1>
<p>paragraph 1 blah blah blah</p>
</body>
</html>
Open root
Make sure that you can see file extensions
View > Show > File Name Extensions
Create a New Text Document.
Name it index.html
Right click and choose Open With and select Visual Studio Code or an editor of your choice.
Add the code from earlier and save the file
Now reload localhost in the browser.
You should see your page.