Synchronet v3.17b-Win32 (install) has been released (Jan-2019).

New Synchronet YouTube channel

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 revision Previous revision
Next revision
Previous revision
server:web [2010/02/21 21:27]
digitalman
server:web [2015/11/09 21:04] (current)
deuce [webctrl.ini per-directory configuration file] Move AccessRequirements example into AccessRequirements section.
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 ''​[Web]''​ section of your [[Startup INI]] file contains the following settings (keys):+The ''​[Web]''​ section of your [[config:​sbbs.ini]] file contains the following settings (keys):
  
 === RootDirectory === === RootDirectory ===
Line 24: Line 26:
 ''​http://​yourbbs.synchro.net/​index.html''​ will be served out of this directory. ''​http://​yourbbs.synchro.net/​index.html''​ will be served out of this directory.
  
-::!:: Older versions of Synchronet had this value default to ''​../​web/​html''​.+**NOTE**: Older versions of Synchronet had this value default to ''​../​web/​html''​
  
 === ErrorDirectory === === ErrorDirectory ===
 Default value: ''​error''​ Default value: ''​error''​
  
-The directory relative to [#​RootDirectory]] where the various error+The directory relative to [[#​RootDirectory]] where the various error
 message files are located. ​ The error message files are named by the message files are located. ​ The error message files are named by the
 numeric HTTP error code they will represent and may be either ''​.html''​ numeric HTTP error code they will represent and may be either ''​.html''​
Line 47: Line 49:
 === Authorization === === Authorization ===
  
-Default value: ''​Basic,​Default''​+Default value: ''​Basic,​Digest''​
  
 A comma-separated list of authentication mechanisms in order of preference. A comma-separated list of authentication mechanisms in order of preference.
Line 111: Line 113:
 Default value: ''​NO_HOST_LOOKUP''​ Default value: ''​NO_HOST_LOOKUP''​
  
-The | separated list of options to enable. ​ In addition to the standard +The ''​Options''​ key is set to a ''​|'' ​separated list of options to enable. ​ In addition to the [[config:​sbbs.ini|standard options]], the web server also supports the following:
-options, the web server also supports the following:+
  
 ''​DEBUG_RX''​ ''​DEBUG_RX''​
Line 130: Line 131:
 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+''​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/​root/​freebsd.synchro.net/​ if the browser doesn'​t send+ie: ''​web/​root/​freebsd.synchro.net/​'' ​if the browser doesn'​t send
 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 ''​index.html'' ​page in [[#RootDirectory]] something
 like this: like this:
 <code html> <code html>
Line 172: Line 173:
 Disable SSJS execution. Disable SSJS execution.
  
 +''​ALLOW_TLS''​
  
 +Enable TLS support.
 ==== Other configuration files ==== ==== Other configuration files ====
  
-In addition to the ''​[Web]''​ keys in the [[Startup INI]] file, the web server+In addition to the ''​[Web]''​ keys in the [[config:​sbbs.ini]] file, the web server
 also uses some other configuration files: also uses some other configuration files:
  
Line 215: Line 218:
 Each directory under the [[#​RootDirectory]] may have a ''​webctrl.ini''​ file which overrides certain settings for Each directory under the [[#​RootDirectory]] may have a ''​webctrl.ini''​ file which overrides certain settings for
 the directory it's in and all child directories. ​ Configuration keys may be set the directory it's in and all child directories. ​ Configuration keys may be set
-either globally, ​or in a per-filename group. ​ Using the * and ? wildcards as +either globally, in a per-filename group, or, in version 3.17 or greater, a per-directory-name group. 
-the group name such as ''​[*.html]''​. ​ The following keys may be used in these files:+Using the * and ? wildcards as the group name such as ''​[*.html]''​ or ''​[dirname/​]''​. ​ The following keys may be used in these files:
  
 === 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. ​ Will force an HTTP login. files in this directory. ​ Will force an HTTP login.
 +
 +For example, to require a login, but allow **any** user to access files in a
 +directory, but only a sysop to access ''​*.log''​ files and .git directories,​ the following could be used:
 +<file webctrl.ini>​
 +AccessRequirements=level 0
 +[*.log]
 +AccessRequirements=level 90
 +[*.git]
 +AccessRequirements=level 90
 +</​file>​
  
 === Realm === === Realm ===
Line 248: Line 261:
 current directory. ​ This effecively works like a custom 404 page. current directory. ​ This effecively works like a custom 404 page.
  
-For example, to require ​login, but allow **any** user to access files in a +=== FastCGISocket === 
-directorybut only a sysop to access ''​*.log'' ​filesthe following could be used: +Specifies the socket and port of FastCGI listener ​in the <​Address>:<​Port>​ format (ie: 127.0.0.1:​9000). ​ Should be used with wildcard sections like this: 
-  AccessRequirements=level 0 +<file webctrl.ini>​ 
-  [*.log] +[*.php] 
-  AccessRequirements=level90+FastCGISocket=127.0.0.1:​9000 
 +</​file>​ 
 + 
 +Added on November 1st2015 to CVS (in 3.17a). 
 + 
 +See [[howto:​php]] for details on using with PHP. 
 + 
 +=== Rewrite=== 
 +Specifies a Javascript snippet which can modify the http_request.request_string. ​ This allows internal redirects like the RewriteRule feature in Apache .htaccess ​files.  The key must *begin* with the string "​Rewrite"​ which may be followed by any legal INI key characters. ​ The order of execution is not guaranteed. 
 + 
 +Added on November 3rd, 2015 to CVS (in 3.17a). 
 + 
 +=== JSPreExec ==
 +A JavaScript snippet which is executed in the same context as Rewritelines, but before any Rewrites are executed.  ​This allows load()ing some common code before execution... ie: ''​JSPreExec=load(js.startup_dir+'/​rewrite_lib.js'​);''​.
  
 +Added on November 3rd, 2015 to CVS (in 3.17a).
  
 ===== JavaScript Objects ===== ===== JavaScript Objects =====
Line 384: Line 411:
 === Top Navigation === === Top Navigation ===
  
-  ../​web/​templates/​default/​topnav.inc ​../​web/​lib/​topnav_html.ssjs+  ../​web/​templates/​default/​topnav.inc 
 +  ​../​web/​lib/​topnav_html.ssjs
  
-The topnav.inc file contains the basic design of the "​breadcrumbs"​ +The ''​topnav.inc'' ​file contains the basic design of the "​breadcrumbs"​ 
-The links are dynamically generated by topnav_html.ssjs so both+The links are dynamically generated by ''​topnav_html.ssjs'' ​so both
 files need to be addressed when modifying or creating themes. files need to be addressed when modifying or creating themes.
-In the case of the default layout, topnav.inc has a left and right +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 graphic and a middle section that the dynamic content goes.  The
 background image is handled by CSS.  You can change this to anything background image is handled by CSS.  You can change this to anything
 you like. you like.
  
-The topnav_html.ssjs file may seem daunting at first, but it is +The ''​topnav_html.ssjs'' ​file may seem daunting at first, but it is 
 pretty straight forward. ​ It has a series of if statements that pretty straight forward. ​ It has a series of if statements that
 check the current page location and sets up the breadcrumbs based check the current page location and sets up the breadcrumbs based
Line 467: Line 495:
 To change the Default Theme, change: To change the Default Theme, change:
  
-    ​var DefaultTheme="​Default";​+<code javascript>​ 
 +var DefaultTheme="​Default";​ 
 +</​code> ​
 to: to:
-    ​var DefaultTheme="​CoolTheme";​ +<code javascript>​ 
 +var DefaultTheme="​CoolTheme";​ 
 +</​code>​
  
 ==== Special Codes Used in the SSJS Template System ==== ==== Special Codes Used in the SSJS Template System ====
Line 532: Line 563:
 ''​%%name%%''​ is replaced with the HTML encoded value of template.name ''​%%name%%''​ is replaced with the HTML encoded value of template.name
  
-i.e.; Spaces are replaced with: this&​nbsp;​is&​nbsp;​html+i.e.; Spaces are replaced with: ''​this&​nbsp;​is&​nbsp;​html''​
  
 ''​^^name^^''​ is replaced with the URI encoded value of template.name ''​^^name^^''​ is replaced with the URI encoded value of template.name
  
-i.e.; Spaces are replaced with:  this%20is%20URI+i.e.; Spaces are replaced with:  ​''​this%20is%20URI''​
           ​           ​
-''​@@name@@''​ is replaced with the value if template.name+''​@@name@@''​ is replaced with the value if ''​template.name''​
  
 No changes or encoding is performed. No changes or encoding is performed.
  
-''​@@name:​sname@@''​ is replaced with the value of template.name.sname+''​@@name:​sname@@''​ is replaced with the value of ''​template.name.sname''​
 (^^ and %% are also supported) (^^ and %% are also supported)
  
-''​@@JS:​js_expression@@''​ is replaced with the return value of js_expression ​  ​+''​@@JS:​js_expression@@''​ is replaced with the return value of ''​js_expression''​
 (^^ and %% are also supported) (^^ and %% are also supported)
  
-  ​<<​REPEAT name>>​ +<code javascript>​ 
-    @@name:​sname@@ +<<​REPEAT name>>​ 
-  <<END REPEAT name>>​+  @@name:​sname@@ 
 +<<END REPEAT name>
 +</code>
  
-Iterates over the array/​object template.name and replaces name:sname with  +Iterates over the array/​object ​''​template.name'' ​and replaces ​''​name:sname'' ​with  
-the value of template.name.sname.+the value of ''​template.name.sname''​.
 (^^ and %% are also supported) (^^ and %% are also supported)
  
Line 598: Line 631:
 For example, it can check if the user is Guest or an actual user with this line: For example, it can check if the user is Guest or an actual user with this line:
  
-  ​@@JS:​if(user.number==0 || user.security.restrictions&​UFLAG_G) '<​html code for Guest>';​ else '<​html code for registered user>';​@@+<code javascript>​ 
 +@@JS:​if(user.number==0 || user.security.restrictions&​UFLAG_G) '<​html code for Guest>'; ​
 +else '<​html code for registered user>';​@@ 
 +</​code>​
         ​         ​
 What this does is display links specific for Registered Users only to them What this does is display links specific for Registered Users only to them
Line 617: Line 653:
 For example: For example:
  
-  ​template.user_alias=user.alias;​+<code javascript>​ 
 +template.user_alias=user.alias;​ 
 +</​code>​
  
 Now ''​@@user_alias@@''​ can be in any ''​*.inc''​ template files and it will display the Now ''​@@user_alias@@''​ can be in any ''​*.inc''​ template files and it will display the
Line 686: Line 724:
 ==== XJS-specific global methods and properties ==== ==== XJS-specific global methods and properties ====
  
-The following ​JS commands ​are available to XJS files only.+The following ​JavaScript methods and properties ​are available to XJS files only.
  
 === xjs_load(filename) === === xjs_load(filename) ===
Line 699: Line 737:
 check for files. check for files.
  
 +{{indexmenu_n>​4}}
  

In Other Languages