How to Set Up a Local Web Server on Windows, Mac, and Linux

When developing a website, a web designer needs to be able to see his webpages the same way the end user would. Sometimes simply clicking on and viewing your HTML files in the web browser is enough, but if you want to test dynamic content, you will need to set up a local web server. Doing this is quite simple and can easily be accomplished on Windows, Mac, and Linux. There are many types of web servers available, but we will be using Apache as it is the most common server around, very easy to set up, and compatible with all major operating systems.

Set up local web server on Linux

Apache was designed for Unix-like operating systems. Linux falls under this category, and installation and configuration of Apache webserver can be done in one step.

For graphical walkthrough, you can follow this tutorial. Here we will be dealing with command lines.


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, in your web browser, navigate to either “” 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 up “index.html” as root with your favorite text editor.


Change “It Works!” to “Hello World!” and then press “Ctrl + O” and then Enter to save.

Now refresh the webpage on It should change to “Hello World!”


Now that you have set up a simple web server, you can play with the configuration settings in the “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.

The good thing about Mac OS X is that Apache is installed 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 “” 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, we will 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.

Note: You can check out this tutorial to install the full MAMP package.

Set up local web server on Windows

Unlike Linux and Mac OS X, 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 Mac OS X too.

Download the Windows version of XAMPP and begin 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 “” or “localhost” in your web browser, you should see the XAMPP configuration page.


To create a new webpage, the procedure is the same. Open up notepad and create a sample HTML file. Name it “hello.html.”


Save it in the document root located in c:\xampp\htdocs\.


Now navigate to it using your web browser by going to “”



Apache is an excellent solution for building both simple and complex websites, but it is not the only option. While Apache integrates well across all three platforms, you may want to look at IIS as an option for Windows as it supports many Windows authentication features that Apache does not. However, for simply testing the base functionality of a website, Apache is perfect.

Jamin Becker

Jamin Becker is a Computer Science student with a very wide variety of interests in the field. He has a background in system administration and computer security, and has experience with multiple programming languages. He is an avid Linux user and does most of his development on the ArchLinux platform. He also has experience working in a Windows domain environment, and he is very familiar with Windows Server 2008/2012. In his spare time he enjoys working on programming projects revolving around algorithm development.


  1. Apache is not starting
    12:24:09 [Apache] Status change detected: running
    12:24:10 [Apache] Status change detected: stopped
    12:24:10 [Apache] Error: Apache shutdown unexpectedly.
    12:24:10 [Apache] This may be due to a blocked port, missing dependencies,
    12:24:10 [Apache] improper privileges, a crash, or a shutdown by another method.
    12:24:10 [Apache] Press the Logs button to view error logs and check
    12:24:10 [Apache] the Windows Event Viewer for more clues
    12:24:10 [Apache] If you need more help, copy and post this
    12:24:10 [Apache] entire log window on the forums

  2. I think i found the problem:
    12:41:37 [Apache] Problem detected!
    12:41:37 [Apache] Port 80 in use by “C:\Program Files (x86)\Skype\Phone\Skype.exe” with PID 9496!
    12:41:37 [Apache] Apache WILL NOT start without the configured ports free!
    12:41:37 [Apache] You need to uninstall/disable/reconfigure the blocking application
    12:41:37 [Apache] or reconfigure Apache and the Control Panel to listen on a different port
    12:41:37 [Apache] Problem detected!
    12:41:37 [Apache] Port 443 in use by “C:\Program Files (x86)\Skype\Phone\Skype.exe” with PID 9496!
    12:41:37 [Apache] Apache WILL NOT start without the configured ports free!
    12:41:37 [Apache] You need to uninstall/disable/reconfigure the blocking application
    12:41:37 [Apache] or reconfigure Apache and the Control Panel to listen on a different port
    How do i fix this?

Comments are closed.