Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howto:apache [2010/03/06 16:33] digitalmanhowto:apache [2018/03/01 12:21] (current) – old revision restored digital man
Line 1: Line 1:
 ====== Use Apache HTTP Server with Synchronet ====== ====== Use Apache HTTP Server with Synchronet ======
-FIXME+The Apache HTTP Server (httpd) supports dynamic content via external executables called [[wp>CGI]] programs. 
 + 
 +===== MOD_PROXY ===== 
 +Probably the best way to integrate Synchronet behind Apache is to [[http://www.google.com/search?q=apache+mod_proxy+reverse+proxy|configure MOD_PROXY on Apache]] to reverse-proxy calls for .ssjs files to Synchronet's HTTP server running on a different port.  It's worth noting that the current SBBS web interface is setup to use HTTP Authentication, and would need to be adjusted to support a cookie based authentication scheme.  By configuring Apache to use the same directory as SBBS, you can rely on Apache to perform caching and compression of non-dynamic content to be delivered directly. 
 + 
 +===== IIS ===== 
 +[[http://www.roughneckbbs.com/|Roughneck BBS]] is currently using a custom reverse proxy for use with IIS.  You may email the sysop for a copy. 
 + 
 +===== JSexec ===== 
 + 
 +The easiest way to get dynamic Synchronet content (e.g. users, messages, files) served by the Apache HTTP Server is by using [[util:JSexec]] as a CGI program to execute JavaScript (e.g. ''.js'' or ''.ssjs'') files that generate dynamic HTML (on ''stdout''). 
 + 
 +==== CGI JavaScript ==== 
 +JavaScript code that generates dynamic CGI content must first send one or more headers, followed by a blank-line, followed by the actual content (e.g. HTML). 
 + 
 +=== Example === 
 + 
 +As an example, the following generates a very basic one-line header (declaring the content to be plain-text), followed by a blank line, followed by one line of text (the ubiquitous ''Hello, World!''): 
 + 
 +<code javascript> 
 +print("Content-Type: text/plain"); 
 +print(); 
 +print("Hello, world!"); 
 +</code> 
 + 
 +:!: If the content is going to contain HTML, then you would want to declare the ''Content-Type'' to be ''text/html'' instead. 
 + 
 +==== Unix Examples ==== 
 + 
 +For example, to execute the ''[[dir:exec]]/nodelist-html.js'' script to display to a web client a dynamically-generated BBS node list in HTML, create a file named ''nodelist'' in your Apache content ''cgi-bin'' directory containing the following 2 lines: 
 + 
 +<file nodelist> 
 +#!/bin/sh 
 +exec /sbbs/exec/jsexec -c/sbbs/ctrl nodelist-html.js 
 +</file> 
 + 
 +:!: Don't forget to make the file executable: ''chmod a+x nodelist'' 
 + 
 +Now when a web client requests the URL ''%%http://yourbbs.com/cgi-bin/nodelist%%'' from your Apache HTTP Server, they'll get the dynamic Synchronet node-list in HTML. 
 + 
 +Another option is to embed the JavaScript code in the CGI executable file itself. As an example, creating the file ''cgi-bin/test.cgi'' containing the following 4 lines: 
 + 
 +<file test.cgi> 
 +#!/usr/sbin/jsexec -c/sbbs/ctrl 
 +print("Content-Type: text/plain"); 
 +print(); 
 +print("Hello, world!"); 
 +</file> 
 + 
 +:!: Don't forget to make the file executable: ''chmod a+x test.cgi'' 
 + 
 +Now when a web client requests the URL ''%%http://yourbbs.com/cgi-bin/test.cgi%%'' from your Apache HTTP Server, they'll get the "Hello, world!" message. 
 ===== See Also ===== ===== See Also =====
 +  * [[custom:javascript|JavaScript]]
   * [[util:JSexec]]   * [[util:JSexec]]
   * [[:howto:|HowTo index]]   * [[:howto:|HowTo index]]
 +
 +{{tag>apache http web cgi javascript jsexec unix}}