Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
server:web [2021/01/27 20:37] – Removed (now broken) webv4 documentation links. ecbbs | server:web [2023/12/23 02:14] (current) – [Configure] Update SCFG screenshot digital man | ||
---|---|---|---|
Line 7: | Line 7: | ||
The Synchronet Web Server is a mostly HTTP 1.1 compliant web server capable of | The Synchronet Web Server is a mostly HTTP 1.1 compliant web server capable of | ||
handing basic web servicing tasks. | handing basic web servicing tasks. | ||
- | general-purpose web server one would come to expect | + | general-purpose web server one would come to expect, including |
It also, through Server-Side JavaScript (SSJS), allows dynamic pages to be | It also, through Server-Side JavaScript (SSJS), allows dynamic pages to be | ||
Line 13: | Line 13: | ||
- | ===== Configuration | + | ===== Configure |
- | ==== Startup INI [Web] Section Keys ==== | + | The Synchronet |
- | The '' | + | < |
+ | ╔══════════════════════════════════════════════════════════════════╗ | ||
+ | ║ | ||
+ | ╠══════════════════════════════════════════════════════════════════╣ | ||
+ | ║ │Enabled | ||
+ | ║ │Log Level | ||
+ | ║ │HTTP Interfaces | ||
+ | ║ │HTTP Port | ||
+ | ║ │HTTPS Support | ||
+ | ║ │HTTPS Interfaces | ||
+ | ║ │HTTPS Port 443 ║ | ||
+ | ║ │SSJS File Extension | ||
+ | ║ │Index Filenames | ||
+ | ║ │Content Root Directory | ||
+ | ║ │Error Sub-directory | ||
+ | ║ │Strict Transport Security | ||
+ | ║ │Virtual Host Support | ||
+ | ║ │Access Logging | ||
+ | ║ │Max Clients | ||
+ | ║ │Max Inactivity | ||
+ | ║ │Filebase Index Script | ||
+ | ║ │Filebase VPath Prefix | ||
+ | ║ │Filebase VPath for VHosts | ||
+ | ║ │Authentication Methods | ||
+ | ║ │Output Buffer Drain Timeout | ||
+ | ║ │Lookup Client Hostname | ||
+ | ║ │CGI Support | ||
+ | ║ │CGI Directory | ||
+ | ║ │CGI File Extensions | ||
+ | ║ │CGI Default Content-Type | ||
+ | ║ │CGI Max Inactivity | ||
+ | ║ │JavaScript Settings... | ||
+ | ║ │Failed Login Attempts... | ||
+ | ╚══════════════════════════════════════════════════════════════════╝ | ||
+ | </ | ||
+ | |||
+ | ... or via [[monitor: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ... or via manual edit of the '' | ||
+ | |||
+ | ==== sbbs.ini ==== | ||
+ | |||
+ | The '' | ||
+ | |||
+ | ^ Key ^ Default | ||
+ | | AutoStart | ||
+ | | HostName | ||
+ | | LogLevel | ||
+ | | TLSErrorLevel | ||
+ | | Interface | ||
+ | | TLSInterface | ||
+ | | Port | '' | ||
+ | | TLSPort | ||
+ | | BindRetryCount | ||
+ | | BindRetryDelay | ||
+ | | MaxClients | ||
+ | | MaxInactivity | ||
+ | | MaxCgiInactivity | ||
+ | | SemFileCheckFrequency | ||
+ | | IndexFileNames | ||
+ | | RootDirectory | ||
+ | | ErrorDirectory | ||
+ | | CGIDirectory | ||
+ | | DefaultCGIContent | ||
+ | | CGIExtensions | ||
+ | | JavaScriptExtension | ||
+ | | Authentication | ||
+ | | HttpLogFile | ||
+ | | FileIndexScript | ||
+ | | FileVPathPrefix | ||
+ | | FileVPathForVHosts | ||
+ | | OutbufDrainTimeout | ||
+ | | TempDirectory | ||
+ | | Options | ||
+ | |||
+ | === Options === | ||
+ | |||
+ | The '' | ||
+ | |||
+ | Default value: **'' | ||
+ | |||
+ | In addition to the [[config: | ||
+ | |||
+ | == DEBUG_RX == | ||
+ | |||
+ | Log all received data to the console log, as well as various | ||
+ | extra bits related to receiving data. | ||
+ | |||
+ | == DEBUG_TX == | ||
+ | |||
+ | Log all transmitted data except the reply body itself, as well | ||
+ | as various extra bits of information related to transmitted | ||
+ | data. | ||
+ | |||
+ | == DEBUG_SSJS == | ||
+ | |||
+ | Log server-side JavaScript execution details. | ||
+ | |||
+ | == VIRTUAL_HOSTS == | ||
+ | |||
+ | Supports name-based virtual hosts. | ||
+ | host names, you can have each host name return unique content | ||
+ | depending on which hostname is used. ie: if | ||
+ | '' | ||
+ | system, you could have FreeBSD-specific pages on one, and | ||
+ | general *nix stuff on the other. | ||
+ | |||
+ | A virtual host is added by simply putting the desired content | ||
+ | into a sub-directory of [[# | ||
+ | ie: '' | ||
+ | the request host name (very old browsers, or some automated | ||
+ | tools) they will be served out of document root. | ||
+ | It is therefore a good idea to put links to your various | ||
+ | virtual hosts in an '' | ||
+ | like this: | ||
+ | <code html> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | Your browser is either too old to support | ||
+ | name-based virtual hosts, or you have visited a | ||
+ | virtual hosts that is not yet configured. | ||
+ | following are hosted here:< | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | == NO_CGI == | ||
+ | |||
+ | Disable CGI/FastCGI script execution. | ||
+ | |||
+ | == HTTP_LOGGING == | ||
+ | |||
+ | Enable logging to a Common Logfile Format log as described in | ||
+ | the HttpLogFile section. | ||
+ | programs (like Webalizer: http:// | ||
+ | |||
+ | == NO_JAVASCRIPT == | ||
+ | |||
+ | Disable SSJS execution. | ||
+ | |||
+ | == ALLOW_TLS == | ||
+ | |||
+ | Enable TLS/SSL support. | ||
+ | |||
+ | == HSTS_SAFE == | ||
+ | |||
+ | Indicates that all URLs available via http are also available via https and redirects clients who want a TLS session to the https location. | ||
+ | |||
+ | ==== Reference ==== | ||
+ | |||
+ | Web Server configuration settings reference: | ||
+ | |||
=== RootDirectory === | === RootDirectory === | ||
Line 109: | Line 267: | ||
(if enabled, see next item), date, and '' | (if enabled, see next item), date, and '' | ||
- | === Options | + | === FileVPathPrefix |
+ | Default value: "" | ||
- | Default | + | Suggested |
- | The '' | + | A virtual sub-directory |
- | '' | + | === FileVPathForVHosts === |
- | + | Default value: '' | |
- | Log all received data to the console log, as well as various | + | |
- | extra bits related to receiving data. | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Log all transmitted data except the reply body itself, as well | + | |
- | as various extra bits of information related to transmitted | + | |
- | data. | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Supports name-based virtual hosts. | + | |
- | host names, you can have each host name return unique content | + | |
- | depending on which hostname is used. ie: if | + | |
- | '' | + | |
- | system, you could have FreeBSD-specific pages on one, and | + | |
- | general *nix stuff on the other. | + | |
- | + | ||
- | A virtual host is added by simply putting the desired content | + | |
- | into a sub-directory of [[# | + | |
- | ie: '' | + | |
- | the request host name (very old browsers, or some automated | + | |
- | tools) they will be served out of document root. | + | |
- | It is therefore a good idea to put links to your various | + | |
- | virtual hosts in an '' | + | |
- | like this: | + | |
- | <code html> | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | Your browser is either too old to support | + | |
- | name-based virtual hosts, or you have visited a | + | |
- | virtual hosts that is not yet configured. | + | |
- | following are hosted here:< | + | |
- | <a href=" | + | |
- | <a href=" | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Disable CGI script execution. | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Enable logging to a Common Logfile Format log as described in | + | |
- | the HttpLogFile section. | + | |
- | programs (like Webalizer: http:// | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Disable SSJS execution. | + | |
- | '' | + | By default, virtual hosts will not have the virtual file path (if enabled). Set this to '' |
- | Enable TLS support. | + | === FileIndexScript === |
+ | Default value: "" | ||
- | '' | + | Suggested value: |
- | Indicates that all URLs availabe via http are also available via https and redirects clients who want a TLS session | + | A Server-side JavaScript (SSJS) file to execute |
==== Other configuration files ==== | ==== Other configuration files ==== | ||
Line 220: | Line 325: | ||
- | ==== webctrl.ini | + | ==== webctrl.ini ==== |
Each directory under the [[# | Each directory under the [[# | ||
the directory it's in and all child directories. | the directory it's in and all child directories. | ||
Line 227: | Line 333: | ||
=== AccessRequirements === | === AccessRequirements === | ||
- | Specifices | + | Specifies |
files in this directory. | files in this directory. | ||
Line 267: | Line 373: | ||
=== FastCGISocket === | === FastCGISocket === | ||
- | Specifies the socket | + | Specifies the socket |
<file webctrl.ini> | <file webctrl.ini> | ||
[*.php] | [*.php] | ||
FastCGISocket=127.0.0.1: | FastCGISocket=127.0.0.1: | ||
</ | </ | ||
- | |||
- | Added on November 1st, 2015 to CVS (in 3.17a). | ||
See [[howto: | See [[howto: | ||
Line 280: | Line 384: | ||
Specifies a Javascript snippet which can modify the http_request.request_string. | Specifies a Javascript snippet which can modify the http_request.request_string. | ||
- | Added on November 3rd, 2015 to CVS (in 3.17a). | + | <file webctrl.ini> |
+ | RewriteDetail=var n=http_request.request_string.replace(/ | ||
+ | </ | ||
+ | |||
+ | If the expression returns " | ||
+ | an internal redirect. | ||
+ | |||
+ | Added on November 3rd, 2015 to CVS (in 3.17a). | ||
=== JSPreExec === | === JSPreExec === | ||
Line 360: | Line 471: | ||
is the remote hostname. | is the remote hostname. | ||
+ | === scheme === | ||
+ | " | ||
==== http_reply object ==== | ==== http_reply object ==== | ||
Line 401: | Line 514: | ||
See also: the RootDirectory key under [Web] in [[config: | See also: the RootDirectory key under [Web] in [[config: | ||
- | |||
- | |||
- | ===== The SSJS Template System ===== | ||
- | The default web pages use a SSJS Template engine which also allows for Theme | ||
- | support. | ||
- | |||
- | [Note: | ||
- | |||
- | |||
- | ==== The SSJS Template Scheme ==== | ||
- | |||
- | Each page consists of four parts: | ||
- | |||
- | === The Header | ||
- | ../ | ||
- | |||
- | This file contains the basic requirements for the HTML page. | ||
- | The opening HTML, doctype, title, CSS file link, etc. The | ||
- | header file includes the open body, System Name, and User | ||
- | greeting plus the initial page layout table start. | ||
- | of the layout is continued in the next files. | ||
- | |||
- | === Top Navigation === | ||
- | |||
- | ../ | ||
- | ../ | ||
- | |||
- | The '' | ||
- | The links are dynamically generated by '' | ||
- | files need to be addressed when modifying or creating themes. | ||
- | In the case of the default layout, '' | ||
- | graphic and a middle section that the dynamic content goes. The | ||
- | background image is handled by CSS. You can change this to anything | ||
- | you like. | ||
- | |||
- | The '' | ||
- | pretty straight forward. | ||
- | check the current page location and sets up the breadcrumbs based | ||
- | on what you want it to say. | ||
- | |||
- | For example: | ||
- | You want to add a Links page called links.html in the main | ||
- | directory. | ||
- | as: | ||
- | |||
- | <code javascript> | ||
- | if(http_request.virtual_path=="/ | ||
- | template.topnav.push({html: | ||
- | </ | ||
- | | ||
- | === Left Side Navigation === | ||
- | |||
- | ../ | ||
- | ../ | ||
- | ../ | ||
- | |||
- | This starts the main table layout in the default layout and also | ||
- | provides two other things -- the main navigation links and a brief | ||
- | nodelisting that displays when users are online via telnet. | ||
- | The links are dynamically created as in the Top Navigation example | ||
- | above with the exception of the two static links. | ||
- | |||
- | === Main Content (various files) === | ||
- | |||
- | This is where the layout of the main content is created. | ||
- | to look at the various files in '' | ||
- | '' | ||
- | various functions of the Web side of Synchronet. | ||
- | each of the special codes contained in those files do will follow. | ||
- | |||
- | === Footer === | ||
- | | ||
- | ../ | ||
- | | ||
- | This file contains the closing HTML and whatever bottom information | ||
- | you would like. In the case of the default layout, the | ||
- | Web Server/ | ||
- | privacy statements or anything else can be placed here and they will | ||
- | be displayed at the bottom of each page. | ||
- | |||
- | |||
- | ==== SSJS Theme Support ==== | ||
- | |||
- | Theme Layouts can be added to Synchronet by creating them and placing the | ||
- | *.inc files in their own directory under ../ | ||
- | |||
- | Themes are activated by editing the ../ | ||
- | This file contains: | ||
- | <code javascript> | ||
- | /* Set default theme name */ | ||
- | var DefaultTheme=" | ||
- | |||
- | /* Edit this bit to add/ | ||
- | Themes[" | ||
- | Themes[" | ||
- | Themes[" | ||
- | Themes[" | ||
- | </ | ||
- | |||
- | Themes are added by editing below the Default Theme such as: | ||
- | <code javascript> | ||
- | Themes[" | ||
- | Themes[" | ||
- | Themes[" | ||
- | Themes[" | ||
- | </ | ||
- | To change the Default Theme, change: | ||
- | |||
- | <code javascript> | ||
- | var DefaultTheme=" | ||
- | </ | ||
- | to: | ||
- | <code javascript> | ||
- | var DefaultTheme=" | ||
- | </ | ||
- | |||
- | ==== Special Codes Used in the SSJS Template System ==== | ||
- | |||
- | By looking at at the message related files located in templates/ | ||
- | it can be seen that some special codes are used to display dynamically created | ||
- | content. It is very important to maintain the information EXACTLY as seen in | ||
- | each file or else the messaging system will fail. While how it is displayed | ||
- | can be changed, the correct information will only be dispayed by following the | ||
- | format in the *.inc files. | ||
- | |||
- | For example the groups.inc: | ||
- | <code html> | ||
- | <!-- Main Content --> | ||
- | | ||
- | <td class=" | ||
- | |||
- | <table class=" | ||
- | <tr> | ||
- | <th class=" | ||
- | </tr> | ||
- | << | ||
- | <tr> | ||
- | <td class=" | ||
- | <a class=" | ||
- | %%groups: | ||
- | <td class=" | ||
- | @@JS: | ||
- | </tr> | ||
- | <<END REPEAT groups>> | ||
- | </ | ||
- | <br /> | ||
- | |||
- | <!-- end Main Content --> | ||
- | </ | ||
- | |||
- | While the table layout can be changed or even eliminated, the information | ||
- | within the << | ||
- | To remove the table yet keep the correct infomation, the resulting groups.inc | ||
- | would be changed to (while maintaining the main table layout in this case) to: | ||
- | <code html> | ||
- | <!-- Main Content --> | ||
- | | ||
- | <td class=" | ||
- | |||
- | << | ||
- | <a class=" | ||
- | %%groups: | ||
- | @@JS: | ||
- | <<END REPEAT groups>> | ||
- | |||
- | <br /> | ||
- | |||
- | <!-- end Main Content --> | ||
- | </ | ||
- | |||
- | This principle applies to all the .inc files in msgs respectively. | ||
- | |||
- | ==== The SSJS Template Library ==== | ||
- | |||
- | '' | ||
- | |||
- | i.e.; Spaces are replaced with: '' | ||
- | |||
- | '' | ||
- | |||
- | i.e.; Spaces are replaced with: '' | ||
- | | ||
- | '' | ||
- | |||
- | No changes or encoding is performed. | ||
- | |||
- | '' | ||
- | (^^ and %% are also supported) | ||
- | |||
- | '' | ||
- | (^^ and %% are also supported) | ||
- | |||
- | <code javascript> | ||
- | << | ||
- | @@name: | ||
- | <<END REPEAT name>> | ||
- | </ | ||
- | |||
- | Iterates over the array/ | ||
- | the value of '' | ||
- | (^^ and %% are also supported) | ||
- | |||
- | |||
- | ==== SSJS Message Configuration ==== | ||
- | |||
- | Configuration settings for the SSJS Messaging system is located in the | ||
- | '' | ||
- | <code javascript> | ||
- | max_messages=20; | ||
- | max_pages=30; | ||
- | next_msg_html=" | ||
- | prev_msg_html=" | ||
- | next_page_html=" | ||
- | prev_page_html=" | ||
- | showall_subs_enable_html=" | ||
- | showall_subs_disable_html=" | ||
- | show_messages_all_html=" | ||
- | show_messages_yours_html=" | ||
- | show_messages_your_unread_html=" | ||
- | show_messages_spacer_html="& | ||
- | anon_only_message=" | ||
- | anon_allowed_message='< | ||
- | anon_reply_message='< | ||
- | private_only_message=" | ||
- | private_allowed_message='< | ||
- | private_reply_message='< | ||
- | </ | ||
- | |||
- | Each of these are configurable. | ||
- | |||
- | See the actual file for the defaults currently in use. | ||
- | |||
- | ==== Embedded Javascript ==== | ||
- | |||
- | The '' | ||
- | which is parsed by the JavaScript engine. | ||
- | number of embedded JavaScript in the *.inc files slow down overall processing | ||
- | of pages. | ||
- | |||
- | Anything contained within '' | ||
- | engine. | ||
- | |||
- | For example, it can check if the user is Guest or an actual user with this line: | ||
- | |||
- | <code javascript> | ||
- | @@JS: | ||
- | else '< | ||
- | </ | ||
- | | ||
- | What this does is display links specific for Registered Users only to them | ||
- | and not Guest. | ||
- | Note, it also can be used to display HTML based on location as in the | ||
- | node listing stuff. In this case, it checks for whether or not a user is | ||
- | online, or if the user is anywhere but the Who's Online page before displaying | ||
- | the Left side node listing. | ||
- | |||
- | IMPORTANT! | ||
- | will be errors in parsing. | ||
- | |||
- | ==== global_defs.ssjs ==== | ||
- | |||
- | This version of the Web Layout now includes a new file called | ||
- | '' | ||
- | be used for creating global definitions that span all pages of a site. | ||
- | For example: | ||
- | |||
- | <code javascript> | ||
- | template.user_alias=user.alias; | ||
- | </ | ||
- | |||
- | Now '' | ||
- | user's alias. | ||
- | |||
- | Care should be exercised when using this file as loading it up with hundreds | ||
- | of predefined definitions may slow down overall page rendering as the file is | ||
- | loaded on every page. It would be better to just put a few popular | ||
- | definitions that are truly global rather many definitions. | ||
- | inefficient to have thirty of forty message definitions being loaded when a | ||
- | user is looking at the statistics page. | ||
- | |||
===== XJS files ===== | ===== XJS files ===== |