If you are running a static website instead of a dynamic one, you can also check out our review of some of the best static website CMS out there.

Set Up a Local Web Server on Linux

Apache was designed for Unix-like operating systems. Linux falls under this category, and the installation and configuration of an Apache webserver can be done in one step. Here we deal with the command line. Most popular distributions allow you to install Apache without compiling it from source using one simple command. For Debian, Ubuntu, and Ubuntu-based distro: For Red Hat and CentOS Once installed, navigate in your web browser to either “127.0.0.1” or “localhost.” If it displays “It Works!” that means your Apache installation is successful. To better understand how Apache is serving this particular webpage, let’s edit it. To do this, navigate to the root web directory of your Linux local machine. Open “index.html” as root with your favorite text editor. Search for “It Works!” and change the text to something random like “Make Tech Easier!” (It could be anything really.) Make sure to save the file. Now refresh the webpage on 127.0.0.1. You should see “Make Tech Easier!” where “It Works!” was formerly. Now that you have set up a simple web server, you can play with the configuration settings in “apache2.conf.” Note: be aware that every time you make a configuration change, you will need to restart Apache for it to apply. If this does not work, you can restart it by directly executing the upstart file.

Set Up a Local Web Server on macOS

The good thing about macOS is that Apache is installed on it by default. All you need to do is turn it on. In Finder, go to “Applications -> Utilities,” then double-click on Terminal to open it. To turn on your already pre-installed Apache web server, run the following command: To test that our web server is running, navigate to “127.0.0.1” or “localhost” in your web browser. We can change the content of the webpage by simply navigating to the document root the same way we did in Linux. The only thing that is different is the path location. Now edit the “index.html.en” file using your favorite text editor. Change “It works!” to “Hello World!” If we refresh our webpage hosted on 127.0.0.1, we now see the changes reflected. To further configure Apache web server under macOS, navigate to the “httpd.conf” file. Like Linux, you can easily restart the Apache service using the apachectl command with root privileges.

Set Up a Local Web Server on Windows

Unlike Linux and macOS, Windows is not Unix-based, so there is no one-liner to install it. Fortunately, there are several install wizards that bundle things like Apache, MySQL, and PHP together to make our lives easier. One of them is XAMPP. Note: XAMPP is available for Linux and macOS, too. Download the Windows version of XAMPP and begin the installation. Execute the installer when prompted. You can select only Apache if all you need is a web server. However, if you are planning on using a database, you may want to select MySQL as well. Continue through the installation and click “Finish” when complete. By default, the XAMPP control panel will be launched. Click “Start” for Apache and MySQL, if needed. If you navigate to “127.0.0.1” or “localhost” in your web browser, you should see the XAMPP configuration page. To create a new webpage, the procedure is the same. Open notepad and create a sample HTML file. Name it “hello.html.” Save it in the document root located in “c:\xampp\htdocs\”. Navigate to it using your web browser by going to 127.0.0.1/hello.html. You’ll be able to see the webpage you created. Note: WampServer is another solid option for installing Apache on Windows.

Setup a LAN Server in Windows

Another option is to setup a LAN server in Windows. You don’t need to install anything for this method. However, you will need Ethernet cables for a direct connection to your router or router/modem combo. If you what you want is to connect to a remote folder, you don’t have to setup a web server to access it. You can easily do it by mapping a WebDAV drive to Windows.

Additional Devices

If you have a Raspberry Pi, you can also turn it into a personal web server. Find out how to do it here. Image credit: Clay Banks via Unsplash Another option is Python for a simple local HTTP server. It’s already installed on macOS and Linux, but you can install it for Windows from Python.org. Depending on how you’ll use your server, you may want to take extra steps to secure it. For example, there are a variety of open source tools to secure Linux servers. If you’re hosting a website or other resource from your computer, it’s better to use a dedicated computer as the server. You’ll be dealing with more traffic, which uses more resources. This makes it harder for your computer to perform as well for your everyday tasks. Most ISPs don’t mind local servers as they don’t have extreme usage. For instance, basic testing or hosting a calendar server using Baikal. If you’re not sure, contact your ISP to ask and explain what you’re trying to accomplish. If you do need more bandwidth without restrictions, they may set you up with a business account.