/
Apache Integrations

Apache Integrations

How to use Apache to run as a web server

https://www.apachehaus.com/cgi-bin/download.plx

  1. Download Apache2.4(x86 / x64) from this site. Link above

  2. Unzip apache to a desired location

  3. Open httpd.conf
    Eg. C:\httpd-2.4.33-o102o-x64-vc14-r2\Apache24\conf\httpd.conf

  4. Set “ServerRoot” as the parent directory apache directory
    Eg. ServerRoot "C:\httpd-2.4.33-o102o-x64-vc14-r2\Apache24"

  5. Make sure you have these lines modules loaded in httpd.conf, uncomment if commented
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule proxy_http2_module modules/mod_proxy_http2.so
    LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
    LoadModule rewrite_module modules/mod_rewrite.so
    LoadModule ssl_module modules/mod_ssl.so

  6. Add the following config in your httpd.conf
    <VirtualHost *:80>

    ServerName localhost

RewriteEngine On

RewriteCond %{REQUEST_URI}  ^/editor            [NC,OR]

RewriteCond %{QUERY_STRING} transport=websocket    [NC]

RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]

RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]

RewriteRule /(.*)           ws://localhost:8081%{REQUEST_URI} [P,L]

     ProxyRequests Off

ProxyPreserveHost On

 

<Location />

ProxyPass http://127.0.0.1:8081/

ProxyPassReverse http://127.0.0.1:8081/

</Location>

      LogLevel info

</VirtualHost>



  1. Run apache2 as a service ::
    Open a CMD prompt
    Go to bin directory eg.
    prompt> cd C:\httpd-2.4.33-o102o-x64-vc14-r2\Apache24\bin
    prompt> httpd.exe -k install
    prompt> httpd.exe -k start

    It will start apache on port 80

  2. Make sure firewall is enabled for 80. 

  3. For enabling SSL you may similarly use a virtual host config for port 443 (untested)

     

    <VirtualHost *:443>
    ServerName localhost
    RewriteEngine On

RewriteCond %{REQUEST_URI}  ^/editor            [NC,OR]

RewriteCond %{QUERY_STRING} transport=websocket    [NC]

RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]

RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]

RewriteRule /(.*)           wss://localhost:8081%{REQUEST_URI} [P,L]



SSLEngine on                                                                

SSLProtocol all -SSLv2                                                      

SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM                



SSLCertificateFile <Path to SSL cert>                           

SSLCertificateKeyFile <Path to private key file>                        

SSLCertificateChainFile <Path to chained certificate>

 

ProxyRequests Off

ProxyPreserveHost On

 

<Location />

ProxyPass http://127.0.0.1:8081/

ProxyPassReverse http://127.0.0.1:8081/

</Location>

      LogLevel info

</VirtualHost>





Related content