LP#1369169: Add Apache 2.4 specific configuration file for websockets
authorBen Shum <bshum@biblio.org>
Sat, 13 Sep 2014 22:04:54 +0000 (18:04 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 5 Nov 2014 16:17:26 +0000 (11:17 -0500)
For Apache 2.4, there were some necessary modifications for running the
websockets code properly. Similar to how we do things in Evergreen, we
added a new directory for apache_24 which contains the modified apache2.conf
file.

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
examples/apache_24/websockets/apache2.conf [new file with mode: 0644]

diff --git a/examples/apache_24/websockets/apache2.conf b/examples/apache_24/websockets/apache2.conf
new file mode 100644 (file)
index 0000000..9076b5c
--- /dev/null
@@ -0,0 +1,80 @@
+# This is the main Apache 2.4 server configuration file for the OpenSRF
+# WebSockets gateway.
+
+Include mods-available/mpm_prefork.load
+Include mods-available/mpm_prefork.conf
+Include mods-available/access_compat.load
+Include mods-available/authz_core.load
+
+# if we don't want to run as "opensrf", change the LockFile
+#LockFile ${APACHE_LOCK_DIR}/accept.lock
+Mutex file:${APACHE_LOCK_DIR} default
+PidFile ${APACHE_PID_FILE}
+User ${APACHE_RUN_USER}
+Group ${APACHE_RUN_GROUP}
+
+DefaultType None
+HostnameLookups Off
+ErrorLog ${APACHE_LOG_DIR}/error.log
+LogLevel warn
+
+# only affects the initial connection, which should be quick.
+Timeout 30
+
+# WebSockets is KeepAlive on steroids
+KeepAlive Off
+
+<IfModule mpm_prefork_module>
+    StartServers          5
+    MinSpareServers       5
+    MaxSpareServers      20
+    # use ServerLimit to raise beyond 256
+    MaxClients          256
+    MaxRequestsPerChild   0
+</IfModule>
+
+# include the exact mods we need
+Include mods-available/mime.load
+Include mods-available/mime.conf
+# SSL requires mime
+Include mods-available/ssl.load
+Include mods-available/ssl.conf
+Include mods-available/socache_shmcb.load
+Include mods-available/websocket.load
+
+LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
+LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %O" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+# WebSockets via SSL
+Listen 7682
+NameVirtualHost *:7682
+<VirtualHost *:7682>
+    DocumentRoot /var/www
+    ServerName localhost:7682
+    ServerAlias 127.0.0.1:7682
+    SSLEngine on
+    SSLHonorCipherOrder On
+    SSLCipherSuite ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM
+
+    # re-use the certs from the main apache instance
+    SSLCertificateFile /etc/apache2/ssl/server.crt
+    SSLCertificateKeyFile /etc/apache2/ssl/server.key
+</VirtualHost>
+
+# WebSockets via non-SSL
+Listen 7680
+NameVirtualHost *:7680
+<VirtualHost *:7680>
+    ServerName localhost:7680
+    ServerAlias 127.0.0.1:7680
+    DocumentRoot /var/www
+</VirtualHost>
+                                                                                
+# OpenSRF WebSockets gateway
+<Location /osrf-websocket-translator>
+    SetHandler websocket-handler
+    WebSocketHandler /usr/lib/apache2/modules/osrf_websocket_translator.so osrf_websocket_init
+</Location>