How To Setup Apache on Windows Server

  • Last Created On Dec 08, 2024
  • 24
0 0

This tutorial will show you how to run the Apache HTTP server on Windows Server.

Running an HTTP server will allow you to host a web site and put up files for download. Apache is open-source software and one of the top HTTP servers available.

Bundled packages

If you just want to get a Web server running quickly, you can install one of the ready-made packages such as XAMPP which include Apache, PHP, MySQL, and an easy to control interface. Even when using such a package, there are no constraints when it comes to modifying the server configuration. However, for an advanced setup, you may want to manually install your web server.

Installing Apache

Download the Windows MSI installer from the Apache download page and fill in the details. Choose “All Users” and “Service” mode. You will most likely want to leave the port at 80, but you can change it. You simply need to make sure that this port is opened in the Windows Firewall.

After running the installer, the Apache Monitor will have been installed. You can control the status of Apache services from this application – using start, stop, and restart. You can also do so from Windows’ services.msc. By now, you should be able to contact your server on http://127.0.0.1 and see the default Apache page.

You can add, edit, and remove web files from your web server by changing the htdocs folder within the Apache folder. This is the default location for web files. Alternatively, you could make use of virtual hosts in order to use other directories, or set up sub-domains.

Apache has two important configuration files: .htaccess, which applies on a directory-by-directory basis within the web files, and httpd.conf inside Apache’s conf folder, which addresses the main configuration.

Installing PHP

PHP allows you to make use of PHP scripts on your web server and display the results to users.

Download the Windows version of PHP from PHP Windows downloads. Download the proper version and then extract the zip file to c:\php.

Next, edit Apache’s httpd.conf to include the following:

LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

You should then restart the Apache server. In order to test PHP, create a test.php file in your htdocs folder with the following content:

<?php phpinfo() ?>

… then check the output at http://127.0.0.1/test.php.


Your Windows/Apache setup is complete.

Views: 24

Recent Articles

  • How to Install JAX with ROCm Acceleratio...
    87
  • Deploy a PyTorch Workspace on a Vultr Cl...
    68
  • Managing Backup Storage
    77
  • Automating FTP Backups in Windows Server
    69
  • Automating FTP Backups in Linux
    73

Popular Articles

  • Our General Terms & Conditions
    2592
  • Our Privacy Policy
    2442
  • Our Cookies Policy
    269
  • Our Terms of Use
    147
  • How to Install JAX with ROCm Acceleratio...
    87