Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
server:web [2010/02/21 21:27] – digitalman | server:web [2023/12/19 18:06] – [Startup INI [Web] Section Keys] Document virtual file path related keys digital man | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Web Server ====== | ====== Web Server ====== | ||
+ | |||
+ | The Synchronet Web Server serves static (e.g. files) and dynamic content to HTTP clients (e.g. web browsers). | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 15: | Line 17: | ||
==== Startup INI [Web] Section Keys ==== | ==== Startup INI [Web] Section Keys ==== | ||
- | The '' | + | The '' |
=== RootDirectory === | === RootDirectory === | ||
Line 24: | Line 26: | ||
'' | '' | ||
- | ::!:: Older versions of Synchronet had this value default to '' | + | **NOTE**: Older versions of Synchronet had this value default to '' |
=== ErrorDirectory === | === ErrorDirectory === | ||
Default value: '' | Default value: '' | ||
- | The directory relative to [# | + | The directory relative to [[# |
message files are located. | message files are located. | ||
numeric HTTP error code they will represent and may be either '' | numeric HTTP error code they will represent and may be either '' | ||
Line 47: | Line 49: | ||
=== Authorization === | === Authorization === | ||
- | Default value: '' | + | Default value: '' |
A comma-separated list of authentication mechanisms in order of preference. | A comma-separated list of authentication mechanisms in order of preference. | ||
Line 106: | Line 108: | ||
store Common Logfile Format logs in. The current virtual host | store Common Logfile Format logs in. The current virtual host | ||
(if enabled, see next item), date, and '' | (if enabled, see next item), date, and '' | ||
+ | |||
+ | === FileVPathPrefix === | ||
+ | Default value: "" | ||
+ | |||
+ | Suggested value: ''/ | ||
+ | |||
+ | A virtual sub-directory of your web root to provide direct HTTP[S] access to your file bases. HTTP-AUTH is used for conditional access/ | ||
+ | |||
+ | === FileVPathForVHosts === | ||
+ | Default value: '' | ||
+ | |||
+ | By default, virtual hosts will not have the virtual file path (if enabled). Set this to '' | ||
+ | |||
+ | === FileIndexScript === | ||
+ | Default value: "" | ||
+ | |||
+ | Suggested value: '' | ||
+ | |||
+ | A Server-side JavaScript (SSJS) file to execute and provide HTML/CSS indexes to file libraries and directories accessed via virtual file paths. | ||
=== Options === | === Options === | ||
Line 111: | Line 132: | ||
Default value: '' | Default value: '' | ||
- | The | separated list of options to enable. | + | The '' |
- | options, the web server also supports the following: | + | |
'' | '' | ||
Line 130: | Line 150: | ||
host names, you can have each host name return unique content | host names, you can have each host name return unique content | ||
depending on which hostname is used. ie: if | depending on which hostname is used. ie: if | ||
- | freebsd.synchro.net and nix.synchro.net both resolved to your | + | '' |
system, you could have FreeBSD-specific pages on one, and | system, you could have FreeBSD-specific pages on one, and | ||
general *nix stuff on the other. | general *nix stuff on the other. | ||
A virtual host is added by simply putting the desired content | A virtual host is added by simply putting the desired content | ||
- | into a sub-directory of RootDirectory with the desired hostname | + | into a sub-directory of [[#RootDirectory]] with the desired hostname |
- | ie: web/ | + | ie: '' |
the request host name (very old browsers, or some automated | the request host name (very old browsers, or some automated | ||
tools) they will be served out of document root. | tools) they will be served out of document root. | ||
It is therefore a good idea to put links to your various | It is therefore a good idea to put links to your various | ||
- | virtual hosts in an index.html page in RootDirectory something | + | virtual hosts in an '' |
like this: | like this: | ||
<code html> | <code html> | ||
Line 172: | Line 192: | ||
Disable SSJS execution. | Disable SSJS execution. | ||
+ | '' | ||
+ | |||
+ | Enable TLS support. | ||
+ | |||
+ | '' | ||
+ | |||
+ | Indicates that all URLs available via http are also available via https and redirects clients who want a TLS session to the https location. | ||
==== Other configuration files ==== | ==== Other configuration files ==== | ||
- | In addition to the '' | + | In addition to the '' |
also uses some other configuration files: | also uses some other configuration files: | ||
Line 215: | Line 242: | ||
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. | ||
- | either globally, | + | either globally, in a per-filename group, or, in version 3.17 or greater, a per-directory-name group. |
- | the group name such as '' | + | Using the * and ? wildcards as the group name such as '' |
=== AccessRequirements === | === AccessRequirements === | ||
Specifices an ARS string which all users must match to be able to access | Specifices an ARS string which all users must match to be able to access | ||
files in this directory. | files in this directory. | ||
+ | |||
+ | For example, to require a login, but allow **any** user to access files in a | ||
+ | directory, but only a sysop to access '' | ||
+ | <file webctrl.ini> | ||
+ | AccessRequirements=level 0 | ||
+ | [*.log] | ||
+ | AccessRequirements=level 90 | ||
+ | [*.git] | ||
+ | AccessRequirements=level 90 | ||
+ | </ | ||
=== Realm === | === Realm === | ||
Line 248: | Line 285: | ||
current directory. | current directory. | ||
- | For example, to require a login, but allow **any** user to access files in a | + | === FastCGISocket === |
- | directory, but only a sysop to access | + | Specifies the socket address of a FastCGI listener in either < |
- | | + | <file webctrl.ini> |
- | [*.log] | + | [*.php] |
- | | + | FastCGISocket=127.0.0.1:9000 |
+ | </ | ||
+ | |||
+ | See [[howto: | ||
+ | |||
+ | === Rewrite* === | ||
+ | Specifies a Javascript snippet which can modify the http_request.request_string. | ||
+ | |||
+ | <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). ([[https:// | ||
+ | |||
+ | === JSPreExec === | ||
+ | A JavaScript snippet which is executed in the same context as Rewrite* lines, but before any Rewrites are executed. | ||
+ | Added on November 3rd, 2015 to CVS (in 3.17a). | ||
===== JavaScript Objects ===== | ===== JavaScript Objects ===== | ||
Line 328: | Line 384: | ||
is the remote hostname. | is the remote hostname. | ||
+ | === scheme === | ||
+ | " | ||
==== http_reply object ==== | ==== http_reply object ==== | ||
Line 362: | Line 420: | ||
[, bool secure ]]]]) | [, bool secure ]]]]) | ||
- | ===== 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 topnav.inc file contains the basic design of the " | ||
- | The links are dynamically generated by topnav_html.ssjs so both | ||
- | files need to be addressed when modifying or creating themes. | ||
- | In the case of the default layout, topnav.inc has a left and right | ||
- | 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 topnav_html.ssjs file may seem daunting at first, but it is | ||
- | 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: | ||
- | |||
- | var DefaultTheme=" | ||
- | to: | ||
- | 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: this& | ||
- | |||
- | '' | ||
- | |||
- | i.e.; Spaces are replaced with: this%20is%20URI | ||
- | | ||
- | '' | ||
- | |||
- | No changes or encoding is performed. | ||
- | |||
- | '' | ||
- | (^^ and %% are also supported) | ||
- | |||
- | '' | ||
- | (^^ and %% are also supported) | ||
- | |||
- | << | ||
- | @@name: | ||
- | <<END REPEAT name>> | ||
- | |||
- | Iterates over the array/ | ||
- | the value of template.name.sname. | ||
- | (^^ 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: | ||
- | |||
- | @@JS: | ||
- | | ||
- | 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: | ||
- | |||
- | template.user_alias=user.alias; | ||
- | Now '' | + | ==== Extra global variables ==== |
- | user's alias. | + | |
- | Care should be exercised when using this file as loading it up with hundreds | + | === web_root_dir === |
- | of predefined definitions may slow down overall page rendering as the file is | + | The path to the web server' |
- | loaded on every page. It would be better | + | |
- | 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. | + | |
+ | See also: the RootDirectory key under [Web] in [[config: | ||
===== XJS files ===== | ===== XJS files ===== | ||
Line 686: | Line 484: | ||
==== XJS-specific global methods and properties ==== | ==== XJS-specific global methods and properties ==== | ||
- | The following | + | The following |
=== xjs_load(filename) === | === xjs_load(filename) === | ||
Line 699: | Line 497: | ||
check for files. | check for files. | ||
+ | {{indexmenu_n> | ||