LP#1268619: websockets : additional apache config docs
[opensrf-equinox.git] / examples / apache2 / websockets / apache2.conf
similarity index 58%
rename from examples/apache2/websockets.conf
rename to examples/apache2/websockets/apache2.conf
index 6b8433a..0aaca73 100644 (file)
@@ -1,19 +1,47 @@
-# :vim set syntax apache                                                        
-#
-# This is the top-level configuration file for the 
-# apache2-websockets instance.  For example, in Debian
-# this file lives in /etc/apache2-websockets/sites-available/
-                                                                                
-LogLevel info
-# - log locally                                                                 
-CustomLog /var/log/apache2-websockets/access.log combined                       
-ErrorLog /var/log/apache2-websockets/error.log
-# Add the PID to the error log (Apache 2.4 only)
-# ErrorLogFormat "[%t] [%P] [%l] [pid %P] %F: %E: [client %a] %M"                
-                                                                                
-# ----------------------------------------------------------------------------------
-# Set up our SSL virtual host                                                   
-# ----------------------------------------------------------------------------------
+# This is the main Apache server configuration file for the OpenSRF
+# WebSockets gateway.  
+
+# if we don't want to run as "opensrf", change the LockFile
+LockFile ${APACHE_LOCK_DIR}/accept.lock
+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/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>                                                            
@@ -29,6 +57,7 @@ NameVirtualHost *:7682
     SSLCertificateKeyFile /etc/apache2/ssl/server.key
 </VirtualHost>                                                                  
                                                                                 
+# WebSockets via non-SSL
 Listen 7680
 NameVirtualHost *:7680                                                          
 <VirtualHost *:7680>                                                            
@@ -37,6 +66,7 @@ NameVirtualHost *: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