Also read: 6 of the Best Static Website CMS for You
Set up a local web server on Linux
Apache was designed for Unix-like operating systems. Linux falls under this category, and the initiation and shape of an Apache webserver can be done in one step.
here we deal with the dominate line. Most popular distributions allow you to install Apache without compiling it from source using one simpleton dominate .
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 facility is successful .
To better understand how Apache is serving this detail web page, let ’ s edit it. To do this, navigate to the root world wide web directory of your Linux local machine .
open “ index.html ” as root with your favorite textbook editor program .
search for “ It Works ! ” and change the text to something random like “ Make Tech Easier ! ” ( It could be anything in truth. ) Make certain to save the file .
now refresh the web page on 127.0.0.1. You should see “ Make Tech Easier ! ” where “ It Works ! ” was once .
now that you have set up a simpleton network waiter, 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 immediately executing the kip charge .
Also read: How to Generate SSL Certificates on Linux Using OpenSSL
Set up a Local web server on macOS
The effective 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 stick to command :
To test that our web server is running, voyage to “ 127.0.0.1 ” or “ localhost ” in your web browser .
We can change the content of the web page by just navigating to the document root the lapp direction we did in Linux. The lone matter that is different is the path location .
now edit the “ index.html.en ” file using your front-runner text editor. Change “ It works ! ” to “ Hello World ! ”
If we refresh our web page hosted on 127.0.0.1, we now see the changes reflected .
To promote configure Apache world wide web server under macOS, navigate to the “ httpd.conf ” file .
Like Linux, you can well restart the Apache avail 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 respective 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, excessively .
Download the Windows translation of XAMPP and begin the initiation. 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 a well .
Continue through the installation and chatter “ Finish ” when complete. By default, the XAMPP see panel will be launched .
Click “ Start ” for Apache and MySQL, if needed .
If you navigate to “ 127.0.0.1 ” or “ localhost ” in your network browser, you should see the XAMPP configuration page .
To create a new web page, the operation is the same. open notepad and create a sample HTML file. mention it “ hello.html. ”
Save it in the document ancestor located in “ degree centigrade : \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 web page you created .
Note: WampServer is another solid choice for installing Apache on Windows .
Also read: How to Install and Run the Nginx Server on Windows
Conclusion
Apache is an excellent solution for building both simpleton and complex websites, but it is not the only choice. 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 just testing the base functionality of a web site, Apache is perfective .
subscribe to our newsletter !
Our latest tutorials delivered square to your inbox
Sign up for all newsletters .
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.