How to Set Up a Local Web Server?

The most efficient way to test dynamic content is via a local web server. If you need to know how to set one up, you’re in the right place.

How to Set Up a Local Web Server?

In this article, we’ll show you how to set up a local web server across various operating systems, and how to test for a successful installation.

 How to Set Up a Local Web Server?

A local web server is essentially set up by installing software on your computer to give it web server capabilities; it’s “local” since you’re in charge of managing it. We’ll show you how to change your computer into an HTTP server, mostly based on installing Apache software. But first, here are some pre-requisites:

  • A dedicated computer to become your server
  • Running Windows, or Linux or a Mac computer running macOS
  • An Internet connection
  • Dual-Core 2 GHz or higher
  • 4 GB RAM
  • 1 GB free disk space.

How to Set Up a Local Web Server on Windows 10?

Windows 10 is not Unix-based, therefore, we’ll install XAMPP which is a combination of Apache, MySQL, and PHP. To install XAMPP, do the following:

  1. Navigate to XAMPP and proceed to install the Windows version.
  2. When prompted, execute the installer.
  3. Select “Apache” to install a Web Server only.
  4. Once the installation is complete click “Finish” to open the XAMPP control panel.

To confirm successful installation, enter “127.0.0.1” or “localhost” into your web browser’s address bar. The XAMPP configuration page should display.

How to Set Up a Local Web Server on Mac?

MacOS has the Apache web server pre-installed; to turn it on, do the following:

  1. Click on “Finder”.
  2. Click on “Applications” > “Utilities”, double-click on “Terminal”.
  3. Now enter and run this command to turn on Apache:
    sudo apachectl start
  4. To confirm that Apache is active, enter “127.0.0.1” or “localhost” from your web browser’s address bar. You should see a “It works!” message.

How to Set Up a Local Web Server on Ubuntu?

To install Apache Web Server on Ubuntu Linux 18.04, do the following:

  1. Access a terminal and enter the command:
    sudo apt-get install apache2
  2. Confirm the installation, then sit back whilst Apache is installed.
  3. To confirm that the installation has been successful, enter the following into a web browser’s address bar:
    https://local.server.ip
    • In the web browser, you should see the Apache2 Ubuntu Default Page.

How to Set Up a Local Web Server on Linux?

  1. Access a terminal for Debian and Ubuntu/Ubuntu-based distro and enter the command:
    sudo apt install apache2
    • For CentOS and Red Hat, enter the command:
    sudo dnf install httpd
  2. To confirm the installation was successful enter “localhost” or “127.0.0.1” into your web browser.
    • The Apache’s default welcome page should display “It Works”.

How to Set Up a LAN Web Server?

We’ll now show you how to set up a LAN network via Windows that connects to the internet. First of all, you’ll need the following:

  • a computer (server)
  • a network switch
  • broadband connection
  • a router (with built-in modem)
  • the devices you wish to connect to the network
  • Ethernet cables

Connect Your First Computer:

Connect your router or network switch to the computer using an ethernet cable, then turn it on. If you’re setting up for the first time, the “Set up a network” wizard will do it automatically for you. If it doesn’t appear, do the following:

  1. Click on “Network and Sharing Centre” from either the “Control Panel” or “Settings.”
  2. Select “Set up a new connection or network.”
    • Go through the on-screen instructions.

Configure Your Wi-Fi:

If you want your devices connected to your network wirelessly, you’ll need to set up Wi-Fi; if not, you can use ethernet cables.

Follow the instructions provided in your router/network switch manual to enable the Wi-Fi. To make it as secure as possible, do the following:

  • Consider changing the default SSID (network name), Wi-Fi login, and password. This can be done by logging onto your router, either by going through the network’s settings, or a web browser on your PC.
  • Be sure to choose the most advanced security protection – currently, it’s WPA2.
  • Now for the changes to take effect, restart your PC.

Connect Your LAN to the Internet:

For your LAN web access, plug your router and modem into the main phone line, using the WAN port.

Connect Your Devices to the LAN:

Whether you’ve connected your devices to the LAN via Wi-Fi or ethernet cable, do the following:

  • On your devices, turn on Wi-Fi
  • Select your network
  • Enter your new password when prompted

To Connect to Your LAN Using Ethernet Cables:

  • Plug the cable into your network switch/router
  • Plug the other end into your device
  • Do the same for your other device[s], you’ll be able to access them from any device on your LAN.

Now Start Sharing:

To set up a “Homegroup” for sharing resources across your network, do the following:

  1. Navigate to “Control Panel” > “Network and Internet” > “Homegroup”.
  2. Select “Create a homegroup” the homegroup setup wizard will start and give you the password needed for the other devices to connect to the LAN.

There are several ways to share and give access to resources in a LAN, including:

  • Right-clicking on files or folders > “Share with…”
  • Adding files to Public folders and switch on “Public Folder Sharing” via the Network and Sharing Centre.

How to Set Up a Local HTTP Server?

Now we’ll show you how to set up a local web server for testing. For a Python installation on Windows, do the following:

  1. Navigate to Python homepage python.org.
  2. At the “Download” section, select the Python ”3.xxx” link.
  3. Towards the bottom of the screen, select the “Windows x86” exe file for downloading.
  4. Run the file when downloaded.
  5. From the first page, be sure to select the “Add Python 3.xxx to PATH” check box.
  6. Select “Install”, then “Close” when completed.
  7. Access the command prompt and enter this command to check for successful installation:
    1. python -V
    2. # Or you may have command py available,
    3. # in that case attempt py -V

This will display the version. If the number is correct, type in the following “cd” command, then at the directory where your example resides:

  1. # add the directory name to enter, e.g.
  2. cd Desktop
  3. # use two dots to go up a directory level if necessary

cd ..

Now to start the server in the directory, enter the following commands:

  1. # If the Python version displayed is more than 3.X
  2. python3 -m http.server
  3. # In windows as an alternative enter “python” to substitute “py -3”, or “python3”
  4. # If Python version 2.X is displayed

python -m SimpleHTTPServer

To see a list of the contents in the directory, go to the server from your web browser’s address bar enter “localhost:8000

If port 8000 is already taken, use another port, e.g.:

  • python3 -m http.server 7800 (Python 3.x) or
  • python -m SimpleHTTPServer 7800 (Python 2.x)

Then enter “localhost:7800” to access the server.

How to Set Up Local Web Server on Windows 10 and MAMP?

For a new installation of MAMP/MAMP PRO on Windows 10, do the following:

  1. Navigate to and download MAMP PRO from  www.mamp.info.
  2. Go to your downloads folder and double click on the “setup_MAMP_MAMP_PRO_4.x.exe” file.
  3. Follow the on-screen instructions to install.

Note: both MAMP PRO “C:\MAMP PRO” and MAMP “C:\MAMP” folders will be installed, ignore the MAMP PRO folder if you don’t want to use the pro version.

Now to run MAMP and test for success, do the following:

  1. In Windows Explorer, navigate to “C:\MAMP” and access the “MAMP.exe.” file. Allow access if you get a security alert.
    • The Apache Server and MySQL Server should start automatically, if not click on “Start Servers”.
  2. From the MAMP menu click on “Preferences.”
  3. Enter” 8888” in the Apache port field.
  4. Select the “Open WebStart Page.”
    •  A “Welcome! MAMP has been installed successfully” page should be displayed.

Additional FAQs

What Is a Local Web Server?

A local web server is a computer that satisfies HTTP requests from the public by returning web pages. For example, a web developer may host a website and have all the files or software necessary for the website physically stored on their computer (locally) as opposed to an external web hosting company.

What Is a LAN?

A LAN (local area network) connects a collection of devices in one area, e.g., in a home, office floor, or building. The size of a LAN can range from thousands of users and devices to just one user.

What Is a WAN?

A WAN (wide area network) connects telecommunications geographically. It is typically used by Government entities, schools, and businesses to relay data to each other, allowing people to carry out their functions regardless of their physical locality.

From a Regular Computer to a Powerful Web Server

Local web servers are great for hosting websites and storing pretty much anything you want to allow others access to. With software packages that magically turn your regular PC or computer into a web server, it’s pretty straightforward to set one up.

Now that we’ve shown you how to set up your own, were you able to get your web server to work? What type of things do you use your web server for? We’d love to hear from you, leave a comment in the section below.

Comments are closed.

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.

Todays Highlights
How to See Google Search History
how to download photos from google photos