Apache Server Installation

To install the Apache Server, perform the following steps.

  1. Stop all IIS services.

  2. Go to the following Web site: https://httpd.apache.org/download.cgi.

    From there, download the current Apache software version.

    Note:
    • We recommend using the current version of the Apache software; however, for the rest of this section, we are referring to an older version v2.4.46. Refer to the Apache documentation for installation steps relevant to the version you are using.

    • Apache does not provide Windows builds directly but instead points to several binary providers. We make no recommendation as to which provider should be used; but it is recommended that you choose a 64-bit version.

  3. Unzip the httpd-2.4.46-o111k-x64-vs16.zip file at a convenient location, such as C:\Program Files\Apache Software Foundation.

    After unzipping the file, you will see the following folders in the C:\Program Files\Apache Software Foundation\Apache24 directory.

  4. Set the path of the two environment variables found in the \System Properties\Advanced\Environment Variables directory to C:\Program Files\Apache Software Foundation\Apache24\bin.

  5. Copy the following three certificates to the C:\Program Files\Apache Software Foundation\Apache24\bin directory.

    • client.pfx

    • root.cer

    • server.pfx

  6. Convert the server.pfx file into associated servercert.pem and serverkey.pem files.

    To do this, open a DOS prompt command and go to the C:\Program Files\Apache Software Foundation\Apache24\bin directory.

    Execute the following commands:

    Copy
    openssl pkcs12 -clcerts -nokeys -in server.pfx -out servercert.pem
    openssl pkcs12 -nocerts -in server.pfx -out serverkey.pem

    Then, copy the servercert.pem and serverkey.pem files to the C:\Program Files\Apache Software Foundation\Apache24 directory.

  7. On the C drive folder, create a passphrase.bat file and create the following command:

    Copy
    @echo hidglobal

    This command will automatically set the certificate password hidglobal without having to enter it manually.

  8. In the C:\Program Files\Apache Software Foundation\Apache24 directory, open the conf folder, and edit the httpd.conf file as follows.

    • Set the Listen port to 8080. Make sure that this port is not used by the Apache Server machine.

    • Enable the headers, the proxy and the SSL modules.

      To do this, uncomment the following lines:

      Copy
      LoadModule headers_module modules/mod_headers.so

      LoadModule proxy_module modules/mod_proxy.so
      LoadModule proxy_connect_module modules/mod_proxy_connect.so
      LoadModule proxy_http_module modules/mod_proxy_http.so
      LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
      LoadModule negotiation_module modules/mod_negotiation.so

      LoadModule ssl_module modules/mod_ssl.so
    • Define the Apache Server name with the following command:

      Copy
      ServerName montana:8080
    • Enable the httpd-ssl.conf file and add the proxy mode. Edit the httpd.conf file as follows:

      Copy
      Include conf/extra/httpd-ssl.conf

      <IfModule mod_proxy.c>
       ProxyRequests off
       ProxyPass / http://nevada.acme.com:49152/
       ProxyPassReverse / http://nevada.acme.com:49152/
      # ProxyPass / http://nevada:49152/
      # ProxyPassReverse / http://nevada:49152/
      </IfModule>
  9. In C:\Program Files\Apache Software Foundation\Apache24\conf directory, open the “extra” folder, and edit the file httpd-ssl.conf as follows:

    • For the SSL configuration, set the Listen port to 32455 and 32456 with the following commands:

      Copy
      Listen 32456
      Listen 32455
    • Call the passphrase.bat file as follows:

      Copy
      SSLPassPhraseDialog exec:C:/passphrase.bat
    • Change the virtualHost port and define the Apache Server name as follows:

      Copy
      <virtualHost _default_:32456>

      ServerName montana:32456
    • Point to the correct servercert.pem and serverkey.pem files as follows:

      Copy
      SSLCertificateFile "C:/Program Files/Apache Software Foundation/Apache24/ServerCert.pem" 

      SSLCertificateKeyFile "C:/Program Files/Apache Software Foundation/Apache24/ServerKey.pem"

      SSLCACertificateFile "C:/Program Files/Apache Software Foundation/Apache24/root.cer"
    • Set the SSLVerify options as follows:

      Copy
      SSLVerifyClient require
      SSLVerifyDepth 1
    • Set the SSLOptions as follows:

      Copy
      SSLOptions +FakeBasicAuth +ExportCertData +StdEnvVars
    • Add the Client Subject DN in the RequestHeader as follows:

      Copy
      RequestHeader set https-frontend-subject "%{SSL_CLIENT_S_DN}e"
    • Duplicate the virtualHost port by adding a second host for the TCP port 32455 as follows:

      Copy
      <virtualHost _default_:32455>

      ServerName montana:32455

      SSLCertificateFile "C:/Program Files/Apache Software Foundation/Apache24/ServerCert.pem"

      SSLCertificateKeyFile "C:/Program Files/Apache Software Foundation/Apache24/ServerKey.pem"

      SSLCACertificateFile "C:/Program Files/Apache Software Foundation/Apache24/root.cer"

      SSLVerifyClient none
      SSLVerifyDepth 1

      SSLOptions +FakeBasicAuth +ExportCertData +StdEnvVars

      </virtualHost >
  10. Open a DOS command prompt window in the C:\Program Files\Apache Software Foundation\Apache24\bin directory and install the Apache Server service with the command:

    Copy
    .\httpd.exe –k install.
    • To start the Apache Server service, use the command: .\httpd.exe -k start

    • To stop the Apache Server service, use the command: .\httpd.exe -k stop

    • To uninstall the Apache Server service, use the command: .\httpd.exe –k uninstall

    To start and stop the Apache server, you can also use the bin\ApacheMonitor.exe file as illustrated next.